Files
enviPy-bayer/static/js/ketcher2/ketcher.js
2025-06-23 20:13:54 +02:00

42 lines
760 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/****************************************************************************
* Copyright 2017 EPAM Systems
*
* 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(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.ketcher=t()}}(function(){var t;return function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n||t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){(function(t){function n(){for(;o.next;){o=o.next;var t=o.task;o.task=void 0;var e=o.domain;e&&(o.domain=void 0,e.enter());try{t()}catch(t){if(u)throw e&&e.exit(),setTimeout(n,0),e&&e.enter(),t;setTimeout(function(){throw t},0)}e&&e.exit()}a=!1}function r(e){i=i.next={task:e,domain:u&&t.domain,next:null},a||(a=!0,s())}var o={task:void 0,next:null},i=o,a=!1,s=void 0,u=!1;if(void 0!==t&&t.nextTick)u=!0,s=function(){t.nextTick(n)};else if("function"==typeof setImmediate)s="undefined"!=typeof window?setImmediate.bind(window,n):function(){setImmediate(n)};else if("undefined"!=typeof MessageChannel){var c=new MessageChannel;c.port1.onmessage=n,s=function(){c.port2.postMessage(0)}}else s=function(){setTimeout(n,0)};e.exports=r}).call(this,t("_process"))},{_process:484}],2:[function(e,n,r){!function(){"use strict";function e(){for(var t=[],n=0;n<arguments.length;n++){var o=arguments[n];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o))t.push(e.apply(null,o));else if("object"===i)for(var a in o)r.call(o,a)&&o[a]&&t.push(a)}}return t.join(" ")}var r={}.hasOwnProperty;void 0!==n&&n.exports?n.exports=e:"function"==typeof t&&"object"==typeof t.amd&&t.amd?t("classnames",[],function(){return e}):window.classNames=e}()},{}],3:[function(t,e,n){e.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},{}],4:[function(t,e,n){var r=t("./_wks")("unscopables"),o=Array.prototype;void 0==o[r]&&t("./_hide")(o,r,{}),e.exports=function(t){o[r][t]=!0}},{"./_hide":35,"./_wks":105}],5:[function(t,e,n){e.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},{}],6:[function(t,e,n){var r=t("./_is-object");e.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},{"./_is-object":44}],7:[function(t,e,n){"use strict";var r=t("./_to-object"),o=t("./_to-absolute-index"),i=t("./_to-length");e.exports=[].copyWithin||function(t,e){var n=r(this),a=i(n.length),s=o(t,a),u=o(e,a),c=arguments.length>2?arguments[2]:void 0,l=Math.min((void 0===c?a:o(c,a))-u,a-s),f=1;for(u<s&&s<u+l&&(f=-1,u+=l-1,s+=l-1);l-- >0;)u in n?n[s]=n[u]:delete n[s],s+=f,u+=f;return n}},{"./_to-absolute-index":91,"./_to-length":95,"./_to-object":96}],8:[function(t,e,n){"use strict";var r=t("./_to-object"),o=t("./_to-absolute-index"),i=t("./_to-length");e.exports=function(t){for(var e=r(this),n=i(e.length),a=arguments.length,s=o(a>1?arguments[1]:void 0,n),u=a>2?arguments[2]:void 0,c=void 0===u?n:o(u,n);c>s;)e[s++]=t;return e}},{"./_to-absolute-index":91,"./_to-length":95,"./_to-object":96}],9:[function(t,e,n){var r=t("./_to-iobject"),o=t("./_to-length"),i=t("./_to-absolute-index");e.exports=function(t){return function(e,n,a){var s,u=r(e),c=o(u.length),l=i(a,c);if(t&&n!=n){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((t||l in u)&&u[l]===n)return t||l||0;return!t&&-1}}},{"./_to-absolute-index":91,"./_to-iobject":94,"./_to-length":95}],10:[function(t,e,n){var r=t("./_ctx"),o=t("./_iobject"),i=t("./_to-object"),a=t("./_to-length"),s=t("./_array-species-create");e.exports=function(t,e){var n=1==t,u=2==t,c=3==t,l=4==t,f=6==t,p=5==t||f,d=e||s;return function(e,s,h){for(var m,g,v=i(e),b=o(v),y=r(s,h,3),_=a(b.length),x=0,w=n?d(e,_):u?d(e,0):void 0;_>x;x++)if((p||x in b)&&(m=b[x],g=y(m,x,v),t))if(n)w[x]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return x;case 2:w.push(m)}else if(l)return!1;return f?-1:c||l?l:w}}},{"./_array-species-create":12,"./_ctx":21,"./_iobject":40,"./_to-length":95,"./_to-object":96}],11:[function(t,e,n){var r=t("./_is-object"),o=t("./_is-array"),i=t("./_wks")("species");e.exports=function(t){var e;return o(t)&&(e=t.constructor,"function"!=typeof e||e!==Array&&!o(e.prototype)||(e=void 0),r(e)&&null===(e=e[i])&&(e=void 0)),void 0===e?Array:e}},{"./_is-array":42,"./_is-object":44,"./_wks":105}],12:[function(t,e,n){var r=t("./_array-species-constructor");e.exports=function(t,e){return new(r(t))(e)}},{"./_array-species-constructor":11}],13:[function(t,e,n){"use strict";var r=t("./_a-function"),o=t("./_is-object"),i=t("./_invoke"),a=[].slice,s={},u=function(t,e,n){if(!(e in s)){for(var r=[],o=0;o<e;o++)r[o]="a["+o+"]";s[e]=Function("F,a","return new F("+r.join(",")+")")}return s[e](t,n)};e.exports=Function.bind||function(t){var e=r(this),n=a.call(arguments,1),s=function(){var r=n.concat(a.call(arguments));return this instanceof s?u(e,r.length,r):i(e,r,t)};return o(e.prototype)&&(s.prototype=e.prototype),s}},{"./_a-function":3,"./_invoke":39,"./_is-object":44}],14:[function(t,e,n){var r=t("./_cof"),o=t("./_wks")("toStringTag"),i="Arguments"==r(function(){return arguments}()),a=function(t,e){try{return t[e]}catch(t){}};e.exports=function(t){var e,n,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=a(e=Object(t),o))?n:i?r(e):"Object"==(s=r(e))&&"function"==typeof e.callee?"Arguments":s}},{"./_cof":15,"./_wks":105}],15:[function(t,e,n){var r={}.toString;e.exports=function(t){return r.call(t).slice(8,-1)}},{}],16:[function(t,e,n){"use strict";var r=t("./_object-dp").f,o=t("./_object-create"),i=t("./_redefine-all"),a=t("./_ctx"),s=t("./_an-instance"),u=t("./_for-of"),c=t("./_iter-define"),l=t("./_iter-step"),f=t("./_set-species"),p=t("./_descriptors"),d=t("./_meta").fastKey,h=t("./_validate-collection"),m=p?"_s":"size",g=function(t,e){var n,r=d(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};e.exports={getConstructor:function(t,e,n,c){var l=t(function(t,r){s(t,l,e,"_i"),t._t=e,t._i=o(null),t._f=void 0,t._l=void 0,t[m]=0,void 0!=r&&u(r,n,t[c],t)});return i(l.prototype,{clear:function(){for(var t=h(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[m]=0},delete:function(t){var n=h(this,e),r=g(n,t);if(r){var o=r.n,i=r.p;delete n._i[r.i],r.r=!0,i&&(i.n=o),o&&(o.p=i),n._f==r&&(n._f=o),n._l==r&&(n._l=i),n[m]--}return!!r},forEach:function(t){h(this,e);for(var n,r=a(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!g(h(this,e),t)}}),p&&r(l.prototype,"size",{get:function(){return h(this,e)[m]}}),l},def:function(t,e,n){var r,o,i=g(t,e);return i?i.v=n:(t._l=i={i:o=d(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=i),r&&(r.n=i),t[m]++,"F"!==o&&(t._i[o]=i)),t},getEntry:g,setStrong:function(t,e,n){c(t,e,function(t,n){this._t=h(t,e),this._k=n,this._l=void 0},function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?"keys"==e?l(0,n.k):"values"==e?l(0,n.v):l(0,[n.k,n.v]):(t._t=void 0,l(1))},n?"entries":"values",!n,!0),f(e)}}},{"./_an-instance":5,"./_ctx":21,"./_descriptors":23,"./_for-of":32,"./_iter-define":48,"./_iter-step":50,"./_meta":57,"./_object-create":61,"./_object-dp":62,"./_redefine-all":77,"./_set-species":81,"./_validate-collection":102}],17:[function(t,e,n){"use strict";var r=t("./_redefine-all"),o=t("./_meta").getWeak,i=t("./_an-object"),a=t("./_is-object"),s=t("./_an-instance"),u=t("./_for-of"),c=t("./_array-methods"),l=t("./_has"),f=t("./_validate-collection"),p=c(5),d=c(6),h=0,m=function(t){return t._l||(t._l=new g)},g=function(){this.a=[]},v=function(t,e){return p(t.a,function(t){return t[0]===e})};g.prototype={get:function(t){var e=v(this,t);if(e)return e[1]},has:function(t){return!!v(this,t)},set:function(t,e){var n=v(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(t){var e=d(this.a,function(e){return e[0]===t});return~e&&this.a.splice(e,1),!!~e}},e.exports={getConstructor:function(t,e,n,i){var c=t(function(t,r){s(t,c,e,"_i"),t._t=e,t._i=h++,t._l=void 0,void 0!=r&&u(r,n,t[i],t)});return r(c.prototype,{delete:function(t){if(!a(t))return!1;var n=o(t);return!0===n?m(f(this,e)).delete(t):n&&l(n,this._i)&&delete n[this._i]},has:function(t){if(!a(t))return!1;var n=o(t);return!0===n?m(f(this,e)).has(t):n&&l(n,this._i)}}),c},def:function(t,e,n){var r=o(i(e),!0);return!0===r?m(t).set(e,n):r[t._i]=n,t},ufstore:m}},{"./_an-instance":5,"./_an-object":6,"./_array-methods":10,"./_for-of":32,"./_has":34,"./_is-object":44,"./_meta":57,"./_redefine-all":77,"./_validate-collection":102}],18:[function(t,e,n){"use strict";var r=t("./_global"),o=t("./_export"),i=t("./_redefine"),a=t("./_redefine-all"),s=t("./_meta"),u=t("./_for-of"),c=t("./_an-instance"),l=t("./_is-object"),f=t("./_fails"),p=t("./_iter-detect"),d=t("./_set-to-string-tag"),h=t("./_inherit-if-required");e.exports=function(t,e,n,m,g,v){var b=r[t],y=b,_=g?"set":"add",x=y&&y.prototype,w={},S=function(t){var e=x[t];i(x,t,"delete"==t?function(t){return!(v&&!l(t))&&e.call(this,0===t?0:t)}:"has"==t?function(t){return!(v&&!l(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return v&&!l(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,n){return e.call(this,0===t?0:t,n),this})};if("function"==typeof y&&(v||x.forEach&&!f(function(){(new y).entries().next()}))){var O=new y,A=O[_](v?{}:-0,1)!=O,E=f(function(){O.has(1)}),j=p(function(t){new y(t)}),P=!v&&f(function(){for(var t=new y,e=5;e--;)t[_](e,e);return!t.has(-0)});j||(y=e(function(e,n){c(e,y,t);var r=h(new b,e,y);return void 0!=n&&u(n,g,r[_],r),r}),y.prototype=x,x.constructor=y),(E||P)&&(S("delete"),S("has"),g&&S("get")),(P||A)&&S(_),v&&x.clear&&delete x.clear}else y=m.getConstructor(e,t,g,_),a(y.prototype,n),s.NEED=!0;return d(y,t),w[t]=y,o(o.G+o.W+o.F*(y!=b),w),v||m.setStrong(y,t,g),y}},{"./_an-instance":5,"./_export":27,"./_fails":29,"./_for-of":32,"./_global":33,"./_inherit-if-required":38,"./_is-object":44,"./_iter-detect":49,"./_meta":57,"./_redefine":78,"./_redefine-all":77,"./_set-to-string-tag":82}],19:[function(t,e,n){var r=e.exports={version:"2.5.1"};"number"==typeof __e&&(__e=r)},{}],20:[function(t,e,n){"use strict";var r=t("./_object-dp"),o=t("./_property-desc");e.exports=function(t,e,n){e in t?r.f(t,e,o(0,n)):t[e]=n}},{"./_object-dp":62,"./_property-desc":76}],21:[function(t,e,n){var r=t("./_a-function");e.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},{"./_a-function":3}],22:[function(t,e,n){e.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},{}],23:[function(t,e,n){e.exports=!t("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":29}],24:[function(t,e,n){var r=t("./_is-object"),o=t("./_global").document,i=r(o)&&r(o.createElement);e.exports=function(t){return i?o.createElement(t):{}}},{"./_global":33,"./_is-object":44}],25:[function(t,e,n){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],26:[function(t,e,n){var r=t("./_object-keys"),o=t("./_object-gops"),i=t("./_object-pie");e.exports=function(t){var e=r(t),n=o.f;if(n)for(var a,s=n(t),u=i.f,c=0;s.length>c;)u.call(t,a=s[c++])&&e.push(a);return e}},{"./_object-gops":67,"./_object-keys":70,"./_object-pie":71}],27:[function(t,e,n){var r=t("./_global"),o=t("./_core"),i=t("./_hide"),a=t("./_redefine"),s=t("./_ctx"),u=function(t,e,n){var c,l,f,p,d=t&u.F,h=t&u.G,m=t&u.S,g=t&u.P,v=t&u.B,b=h?r:m?r[e]||(r[e]={}):(r[e]||{}).prototype,y=h?o:o[e]||(o[e]={}),_=y.prototype||(y.prototype={});h&&(n=e);for(c in n)l=!d&&b&&void 0!==b[c],f=(l?b:n)[c],p=v&&l?s(f,r):g&&"function"==typeof f?s(Function.call,f):f,b&&a(b,c,f,t&u.U),y[c]!=f&&i(y,c,p),g&&_[c]!=f&&(_[c]=f)};r.core=o,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},{"./_core":19,"./_ctx":21,"./_global":33,"./_hide":35,"./_redefine":78}],28:[function(t,e,n){var r=t("./_wks")("match");e.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,!"/./"[t](e)}catch(t){}}return!0}},{"./_wks":105}],29:[function(t,e,n){e.exports=function(t){try{return!!t()}catch(t){return!0}}},{}],30:[function(t,e,n){"use strict";var r=t("./_hide"),o=t("./_redefine"),i=t("./_fails"),a=t("./_defined"),s=t("./_wks");e.exports=function(t,e,n){var u=s(t),c=n(a,u,""[t]),l=c[0],f=c[1];i(function(){var e={};return e[u]=function(){return 7},7!=""[t](e)})&&(o(String.prototype,t,l),r(RegExp.prototype,u,2==e?function(t,e){return f.call(t,this,e)}:function(t){return f.call(t,this)}))}},{"./_defined":22,"./_fails":29,"./_hide":35,"./_redefine":78,"./_wks":105}],31:[function(t,e,n){"use strict";var r=t("./_an-object");e.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},{"./_an-object":6}],32:[function(t,e,n){var r=t("./_ctx"),o=t("./_iter-call"),i=t("./_is-array-iter"),a=t("./_an-object"),s=t("./_to-length"),u=t("./core.get-iterator-method"),c={},l={},n=e.exports=function(t,e,n,f,p){var d,h,m,g,v=p?function(){return t}:u(t),b=r(n,f,e?2:1),y=0;if("function"!=typeof v)throw TypeError(t+" is not iterable!");if(i(v)){for(d=s(t.length);d>y;y++)if((g=e?b(a(h=t[y])[0],h[1]):b(t[y]))===c||g===l)return g}else for(m=v.call(t);!(h=m.next()).done;)if((g=o(m,b,h.value,e))===c||g===l)return g};n.BREAK=c,n.RETURN=l},{"./_an-object":6,"./_ctx":21,"./_is-array-iter":41,"./_iter-call":46,"./_to-length":95,"./core.get-iterator-method":106}],33:[function(t,e,n){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},{}],34:[function(t,e,n){var r={}.hasOwnProperty;e.exports=function(t,e){return r.call(t,e)}},{}],35:[function(t,e,n){var r=t("./_object-dp"),o=t("./_property-desc");e.exports=t("./_descriptors")?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},{"./_descriptors":23,"./_object-dp":62,"./_property-desc":76}],36:[function(t,e,n){var r=t("./_global").document;e.exports=r&&r.documentElement},{"./_global":33}],37:[function(t,e,n){e.exports=!t("./_descriptors")&&!t("./_fails")(function(){return 7!=Object.defineProperty(t("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":23,"./_dom-create":24,"./_fails":29}],38:[function(t,e,n){var r=t("./_is-object"),o=t("./_set-proto").set;e.exports=function(t,e,n){var i,a=e.constructor;return a!==n&&"function"==typeof a&&(i=a.prototype)!==n.prototype&&r(i)&&o&&o(t,i),t}},{"./_is-object":44,"./_set-proto":80}],39:[function(t,e,n){e.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},{}],40:[function(t,e,n){var r=t("./_cof");e.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},{"./_cof":15}],41:[function(t,e,n){var r=t("./_iterators"),o=t("./_wks")("iterator"),i=Array.prototype;e.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},{"./_iterators":51,"./_wks":105}],42:[function(t,e,n){var r=t("./_cof");e.exports=Array.isArray||function(t){return"Array"==r(t)}},{"./_cof":15}],43:[function(t,e,n){var r=t("./_is-object"),o=Math.floor;e.exports=function(t){return!r(t)&&isFinite(t)&&o(t)===t}},{"./_is-object":44}],44:[function(t,e,n){e.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},{}],45:[function(t,e,n){var r=t("./_is-object"),o=t("./_cof"),i=t("./_wks")("match");e.exports=function(t){var e;return r(t)&&(void 0!==(e=t[i])?!!e:"RegExp"==o(t))}},{"./_cof":15,"./_is-object":44,"./_wks":105}],46:[function(t,e,n){var r=t("./_an-object");e.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},{"./_an-object":6}],47:[function(t,e,n){"use strict";var r=t("./_object-create"),o=t("./_property-desc"),i=t("./_set-to-string-tag"),a={};t("./_hide")(a,t("./_wks")("iterator"),function(){return this}),e.exports=function(t,e,n){t.prototype=r(a,{next:o(1,n)}),i(t,e+" Iterator")}},{"./_hide":35,"./_object-create":61,"./_property-desc":76,"./_set-to-string-tag":82,"./_wks":105}],48:[function(t,e,n){"use strict";var r=t("./_library"),o=t("./_export"),i=t("./_redefine"),a=t("./_hide"),s=t("./_has"),u=t("./_iterators"),c=t("./_iter-create"),l=t("./_set-to-string-tag"),f=t("./_object-gpo"),p=t("./_wks")("iterator"),d=!([].keys&&"next"in[].keys()),h=function(){return this};e.exports=function(t,e,n,m,g,v,b){c(n,e,m);var y,_,x,w=function(t){if(!d&&t in E)return E[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},S=e+" Iterator",O="values"==g,A=!1,E=t.prototype,j=E[p]||E["@@iterator"]||g&&E[g],P=j||w(g),T=g?O?w("entries"):P:void 0,C="Array"==e?E.entries||j:j;if(C&&(x=f(C.call(new t)))!==Object.prototype&&x.next&&(l(x,S,!0),r||s(x,p)||a(x,p,h)),O&&j&&"values"!==j.name&&(A=!0,P=function(){return j.call(this)}),r&&!b||!d&&!A&&E[p]||a(E,p,P),u[e]=P,u[S]=h,g)if(y={values:O?P:w("values"),keys:v?P:w("keys"),entries:T},b)for(_ in y)_ in E||i(E,_,y[_]);else o(o.P+o.F*(d||A),e,y);return y}},{"./_export":27,"./_has":34,"./_hide":35,"./_iter-create":47,"./_iterators":51,"./_library":52,"./_object-gpo":68,"./_redefine":78,"./_set-to-string-tag":82,"./_wks":105}],49:[function(t,e,n){var r=t("./_wks")("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}e.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i=[7],a=i[r]();a.next=function(){return{done:n=!0}},i[r]=function(){return a},t(i)}catch(t){}return n}},{"./_wks":105}],50:[function(t,e,n){e.exports=function(t,e){return{value:e,done:!!t}}},{}],51:[function(t,e,n){e.exports={}},{}],52:[function(t,e,n){e.exports=!1},{}],53:[function(t,e,n){var r=Math.expm1;e.exports=!r||r(10)>22025.465794806718||r(10)<22025.465794806718||-2e-17!=r(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:r},{}],54:[function(t,e,n){var r=t("./_math-sign"),o=Math.pow,i=o(2,-52),a=o(2,-23),s=o(2,127)*(2-a),u=o(2,-126),c=function(t){return t+1/i-1/i};e.exports=Math.fround||function(t){var e,n,o=Math.abs(t),l=r(t);return o<u?l*c(o/u/a)*u*a:(e=(1+a/i)*o,n=e-(e-o),n>s||n!=n?l*(1/0):l*n)}},{"./_math-sign":56}],55:[function(t,e,n){e.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},{}],56:[function(t,e,n){e.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},{}],57:[function(t,e,n){var r=t("./_uid")("meta"),o=t("./_is-object"),i=t("./_has"),a=t("./_object-dp").f,s=0,u=Object.isExtensible||function(){return!0},c=!t("./_fails")(function(){return u(Object.preventExtensions({}))}),l=function(t){a(t,r,{value:{i:"O"+ ++s,w:{}}})},f=function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!u(t))return"F";if(!e)return"E";l(t)}return t[r].i},p=function(t,e){if(!i(t,r)){if(!u(t))return!0;if(!e)return!1;l(t)}return t[r].w},d=function(t){return c&&h.NEED&&u(t)&&!i(t,r)&&l(t),t},h=e.exports={KEY:r,NEED:!1,fastKey:f,getWeak:p,onFreeze:d}},{"./_fails":29,"./_has":34,"./_is-object":44,"./_object-dp":62,"./_uid":101}],58:[function(t,e,n){var r=t("./_global"),o=t("./_task").set,i=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u="process"==t("./_cof")(a);e.exports=function(){var t,e,n,c=function(){var r,o;for(u&&(r=a.domain)&&r.exit();t;){o=t.fn,t=t.next;try{o()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(u)n=function(){a.nextTick(c)};else if(i){var l=!0,f=document.createTextNode("");new i(c).observe(f,{characterData:!0}),n=function(){f.data=l=!l}}else if(s&&s.resolve){var p=s.resolve();n=function(){p.then(c)}}else n=function(){o.call(r,c)};return function(r){var o={fn:r,next:void 0};e&&(e.next=o),t||(t=o,n()),e=o}}},{"./_cof":15,"./_global":33,"./_task":90}],59:[function(t,e,n){"use strict";function r(t){var e,n;this.promise=new t(function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r}),this.resolve=o(e),this.reject=o(n)}var o=t("./_a-function");e.exports.f=function(t){return new r(t)}},{"./_a-function":3}],60:[function(t,e,n){"use strict";var r=t("./_object-keys"),o=t("./_object-gops"),i=t("./_object-pie"),a=t("./_to-object"),s=t("./_iobject"),u=Object.assign;e.exports=!u||t("./_fails")(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=u({},t)[n]||Object.keys(u({},e)).join("")!=r})?function(t,e){for(var n=a(t),u=arguments.length,c=1,l=o.f,f=i.f;u>c;)for(var p,d=s(arguments[c++]),h=l?r(d).concat(l(d)):r(d),m=h.length,g=0;m>g;)f.call(d,p=h[g++])&&(n[p]=d[p]);return n}:u},{"./_fails":29,"./_iobject":40,"./_object-gops":67,"./_object-keys":70,"./_object-pie":71,"./_to-object":96}],61:[function(t,e,n){var r=t("./_an-object"),o=t("./_object-dps"),i=t("./_enum-bug-keys"),a=t("./_shared-key")("IE_PROTO"),s=function(){},u=function(){var e,n=t("./_dom-create")("iframe"),r=i.length;for(n.style.display="none",t("./_html").appendChild(n),n.src="javascript:",e=n.contentWindow.document,e.open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;r--;)delete u.prototype[i[r]];return u()};e.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[a]=t):n=u(),void 0===e?n:o(n,e)}},{"./_an-object":6,"./_dom-create":24,"./_enum-bug-keys":25,"./_html":36,"./_object-dps":63,"./_shared-key":83}],62:[function(t,e,n){var r=t("./_an-object"),o=t("./_ie8-dom-define"),i=t("./_to-primitive"),a=Object.defineProperty;n.f=t("./_descriptors")?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},{"./_an-object":6,"./_descriptors":23,"./_ie8-dom-define":37,"./_to-primitive":97}],63:[function(t,e,n){var r=t("./_object-dp"),o=t("./_an-object"),i=t("./_object-keys");e.exports=t("./_descriptors")?Object.defineProperties:function(t,e){o(t);for(var n,a=i(e),s=a.length,u=0;s>u;)r.f(t,n=a[u++],e[n]);return t}},{"./_an-object":6,"./_descriptors":23,"./_object-dp":62,"./_object-keys":70}],64:[function(t,e,n){var r=t("./_object-pie"),o=t("./_property-desc"),i=t("./_to-iobject"),a=t("./_to-primitive"),s=t("./_has"),u=t("./_ie8-dom-define"),c=Object.getOwnPropertyDescriptor;n.f=t("./_descriptors")?c:function(t,e){if(t=i(t),e=a(e,!0),u)try{return c(t,e)}catch(t){}if(s(t,e))return o(!r.f.call(t,e),t[e])}},{"./_descriptors":23,"./_has":34,"./_ie8-dom-define":37,"./_object-pie":71,"./_property-desc":76,"./_to-iobject":94,"./_to-primitive":97}],65:[function(t,e,n){var r=t("./_to-iobject"),o=t("./_object-gopn").f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(t){try{return o(t)}catch(t){return a.slice()}};e.exports.f=function(t){return a&&"[object Window]"==i.call(t)?s(t):o(r(t))}},{"./_object-gopn":66,"./_to-iobject":94}],66:[function(t,e,n){var r=t("./_object-keys-internal"),o=t("./_enum-bug-keys").concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},{"./_enum-bug-keys":25,"./_object-keys-internal":69}],67:[function(t,e,n){n.f=Object.getOwnPropertySymbols},{}],68:[function(t,e,n){var r=t("./_has"),o=t("./_to-object"),i=t("./_shared-key")("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},{"./_has":34,"./_shared-key":83,"./_to-object":96}],69:[function(t,e,n){var r=t("./_has"),o=t("./_to-iobject"),i=t("./_array-includes")(!1),a=t("./_shared-key")("IE_PROTO");e.exports=function(t,e){var n,s=o(t),u=0,c=[];for(n in s)n!=a&&r(s,n)&&c.push(n);for(;e.length>u;)r(s,n=e[u++])&&(~i(c,n)||c.push(n));return c}},{"./_array-includes":9,"./_has":34,"./_shared-key":83,"./_to-iobject":94}],70:[function(t,e,n){var r=t("./_object-keys-internal"),o=t("./_enum-bug-keys");e.exports=Object.keys||function(t){return r(t,o)}},{"./_enum-bug-keys":25,"./_object-keys-internal":69}],71:[function(t,e,n){n.f={}.propertyIsEnumerable},{}],72:[function(t,e,n){var r=t("./_object-keys"),o=t("./_to-iobject"),i=t("./_object-pie").f;e.exports=function(t){return function(e){for(var n,a=o(e),s=r(a),u=s.length,c=0,l=[];u>c;)i.call(a,n=s[c++])&&l.push(t?[n,a[n]]:a[n]);return l}}},{"./_object-keys":70,"./_object-pie":71,"./_to-iobject":94}],73:[function(t,e,n){var r=t("./_object-gopn"),o=t("./_object-gops"),i=t("./_an-object"),a=t("./_global").Reflect;e.exports=a&&a.ownKeys||function(t){var e=r.f(i(t)),n=o.f;return n?e.concat(n(t)):e}},{"./_an-object":6,"./_global":33,"./_object-gopn":66,"./_object-gops":67}],74:[function(t,e,n){e.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},{}],75:[function(t,e,n){var r=t("./_an-object"),o=t("./_is-object"),i=t("./_new-promise-capability");e.exports=function(t,e){if(r(t),o(e)&&e.constructor===t)return e;var n=i.f(t);return(0,n.resolve)(e),n.promise}},{"./_an-object":6,"./_is-object":44,"./_new-promise-capability":59}],76:[function(t,e,n){e.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},{}],77:[function(t,e,n){var r=t("./_redefine");e.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},{"./_redefine":78}],78:[function(t,e,n){var r=t("./_global"),o=t("./_hide"),i=t("./_has"),a=t("./_uid")("src"),s=Function.toString,u=(""+s).split("toString");t("./_core").inspectSource=function(t){return s.call(t)},(e.exports=function(t,e,n,s){var c="function"==typeof n;c&&(i(n,"name")||o(n,"name",e)),t[e]!==n&&(c&&(i(n,a)||o(n,a,t[e]?""+t[e]:u.join(String(e)))),t===r?t[e]=n:s?t[e]?t[e]=n:o(t,e,n):(delete t[e],o(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||s.call(this)})},{"./_core":19,"./_global":33,"./_has":34,"./_hide":35,"./_uid":101}],79:[function(t,e,n){e.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},{}],80:[function(t,e,n){var r=t("./_is-object"),o=t("./_an-object"),i=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,n,r){try{r=t("./_ctx")(Function.call,t("./_object-gopd").f(Object.prototype,"__proto__").set,2),r(e,[]),n=!(e instanceof Array)}catch(t){n=!0}return function(t,e){return i(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:i}},{"./_an-object":6,"./_ctx":21,"./_is-object":44,"./_object-gopd":64}],81:[function(t,e,n){"use strict";var r=t("./_global"),o=t("./_object-dp"),i=t("./_descriptors"),a=t("./_wks")("species");e.exports=function(t){var e=r[t];i&&e&&!e[a]&&o.f(e,a,{configurable:!0,get:function(){return this}})}},{"./_descriptors":23,"./_global":33,"./_object-dp":62,"./_wks":105}],82:[function(t,e,n){var r=t("./_object-dp").f,o=t("./_has"),i=t("./_wks")("toStringTag");e.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},{"./_has":34,"./_object-dp":62,"./_wks":105}],83:[function(t,e,n){var r=t("./_shared")("keys"),o=t("./_uid");e.exports=function(t){return r[t]||(r[t]=o(t))}},{"./_shared":84,"./_uid":101}],84:[function(t,e,n){var r=t("./_global"),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(t){return o[t]||(o[t]={})}},{"./_global":33}],85:[function(t,e,n){var r=t("./_an-object"),o=t("./_a-function"),i=t("./_wks")("species");e.exports=function(t,e){var n,a=r(t).constructor;return void 0===a||void 0==(n=r(a)[i])?e:o(n)}},{"./_a-function":3,"./_an-object":6,"./_wks":105}],86:[function(t,e,n){var r=t("./_to-integer"),o=t("./_defined");e.exports=function(t){return function(e,n){var i,a,s=String(o(e)),u=r(n),c=s.length;return u<0||u>=c?t?"":void 0:(i=s.charCodeAt(u),i<55296||i>56319||u+1===c||(a=s.charCodeAt(u+1))<56320||a>57343?t?s.charAt(u):i:t?s.slice(u,u+2):a-56320+(i-55296<<10)+65536)}}},{"./_defined":22,"./_to-integer":93}],87:[function(t,e,n){var r=t("./_is-regexp"),o=t("./_defined");e.exports=function(t,e,n){if(r(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(o(t))}},{"./_defined":22,"./_is-regexp":45}],88:[function(t,e,n){var r=t("./_to-length"),o=t("./_string-repeat"),i=t("./_defined");e.exports=function(t,e,n,a){var s=String(i(t)),u=s.length,c=void 0===n?" ":String(n),l=r(e);if(l<=u||""==c)return s;var f=l-u,p=o.call(c,Math.ceil(f/c.length));return p.length>f&&(p=p.slice(0,f)),a?p+s:s+p}},{"./_defined":22,"./_string-repeat":89,"./_to-length":95}],89:[function(t,e,n){"use strict";var r=t("./_to-integer"),o=t("./_defined");e.exports=function(t){var e=String(o(this)),n="",i=r(t);if(i<0||i==1/0)throw RangeError("Count can't be negative");for(;i>0;(i>>>=1)&&(e+=e))1&i&&(n+=e);return n}},{"./_defined":22,"./_to-integer":93}],90:[function(t,e,n){var r,o,i,a=t("./_ctx"),s=t("./_invoke"),u=t("./_html"),c=t("./_dom-create"),l=t("./_global"),f=l.process,p=l.setImmediate,d=l.clearImmediate,h=l.MessageChannel,m=l.Dispatch,g=0,v={},b=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},y=function(t){b.call(t.data)};p&&d||(p=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return v[++g]=function(){s("function"==typeof t?t:Function(t),e)},r(g),g},d=function(t){delete v[t]},"process"==t("./_cof")(f)?r=function(t){f.nextTick(a(b,t,1))}:m&&m.now?r=function(t){m.now(a(b,t,1))}:h?(o=new h,i=o.port2,o.port1.onmessage=y,r=a(i.postMessage,i,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(t){l.postMessage(t+"","*")},l.addEventListener("message",y,!1)):r="onreadystatechange"in c("script")?function(t){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),b.call(t)}}:function(t){setTimeout(a(b,t,1),0)}),e.exports={set:p,clear:d}},{"./_cof":15,"./_ctx":21,"./_dom-create":24,"./_global":33,"./_html":36,"./_invoke":39}],91:[function(t,e,n){var r=t("./_to-integer"),o=Math.max,i=Math.min;e.exports=function(t,e){return t=r(t),t<0?o(t+e,0):i(t,e)}},{"./_to-integer":93}],92:[function(t,e,n){var r=t("./_to-integer"),o=t("./_to-length");e.exports=function(t){if(void 0===t)return 0;var e=r(t),n=o(e);if(e!==n)throw RangeError("Wrong length!");return n}},{"./_to-integer":93,"./_to-length":95}],93:[function(t,e,n){var r=Math.ceil,o=Math.floor;e.exports=function(t){return isNaN(t=+t)?0:(t>0?o:r)(t)}},{}],94:[function(t,e,n){var r=t("./_iobject"),o=t("./_defined");e.exports=function(t){return r(o(t))}},{"./_defined":22,"./_iobject":40}],95:[function(t,e,n){var r=t("./_to-integer"),o=Math.min;e.exports=function(t){return t>0?o(r(t),9007199254740991):0}},{"./_to-integer":93}],96:[function(t,e,n){var r=t("./_defined");e.exports=function(t){return Object(r(t))}},{"./_defined":22}],97:[function(t,e,n){var r=t("./_is-object");e.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":44}],
98:[function(t,e,n){"use strict";if(t("./_descriptors")){var r=t("./_library"),o=t("./_global"),i=t("./_fails"),a=t("./_export"),s=t("./_typed"),u=t("./_typed-buffer"),c=t("./_ctx"),l=t("./_an-instance"),f=t("./_property-desc"),p=t("./_hide"),d=t("./_redefine-all"),h=t("./_to-integer"),m=t("./_to-length"),g=t("./_to-index"),v=t("./_to-absolute-index"),b=t("./_to-primitive"),y=t("./_has"),_=t("./_classof"),x=t("./_is-object"),w=t("./_to-object"),S=t("./_is-array-iter"),O=t("./_object-create"),A=t("./_object-gpo"),E=t("./_object-gopn").f,j=t("./core.get-iterator-method"),P=t("./_uid"),T=t("./_wks"),C=t("./_array-methods"),R=t("./_array-includes"),N=t("./_species-constructor"),k=t("./es6.array.iterator"),I=t("./_iterators"),B=t("./_iter-detect"),M=t("./_set-species"),L=t("./_array-fill"),D=t("./_array-copy-within"),F=t("./_object-dp"),G=t("./_object-gopd"),z=F.f,U=G.f,W=o.RangeError,H=o.TypeError,V=o.Uint8Array,q=Array.prototype,K=u.ArrayBuffer,Y=u.DataView,$=C(0),Z=C(2),X=C(3),J=C(4),Q=C(5),tt=C(6),et=R(!0),nt=R(!1),rt=k.values,ot=k.keys,it=k.entries,at=q.lastIndexOf,st=q.reduce,ut=q.reduceRight,ct=q.join,lt=q.sort,ft=q.slice,pt=q.toString,dt=q.toLocaleString,ht=T("iterator"),mt=T("toStringTag"),gt=P("typed_constructor"),vt=P("def_constructor"),bt=s.CONSTR,yt=s.TYPED,_t=s.VIEW,xt=C(1,function(t,e){return Et(N(t,t[vt]),e)}),wt=i(function(){return 1===new V(new Uint16Array([1]).buffer)[0]}),St=!!V&&!!V.prototype.set&&i(function(){new V(1).set({})}),Ot=function(t,e){var n=h(t);if(n<0||n%e)throw W("Wrong offset!");return n},At=function(t){if(x(t)&&yt in t)return t;throw H(t+" is not a typed array!")},Et=function(t,e){if(!(x(t)&&gt in t))throw H("It is not a typed array constructor!");return new t(e)},jt=function(t,e){return Pt(N(t,t[vt]),e)},Pt=function(t,e){for(var n=0,r=e.length,o=Et(t,r);r>n;)o[n]=e[n++];return o},Tt=function(t,e,n){z(t,e,{get:function(){return this._d[n]}})},Ct=function(t){var e,n,r,o,i,a,s=w(t),u=arguments.length,l=u>1?arguments[1]:void 0,f=void 0!==l,p=j(s);if(void 0!=p&&!S(p)){for(a=p.call(s),r=[],e=0;!(i=a.next()).done;e++)r.push(i.value);s=r}for(f&&u>2&&(l=c(l,arguments[2],2)),e=0,n=m(s.length),o=Et(this,n);n>e;e++)o[e]=f?l(s[e],e):s[e];return o},Rt=function(){for(var t=0,e=arguments.length,n=Et(this,e);e>t;)n[t]=arguments[t++];return n},Nt=!!V&&i(function(){dt.call(new V(1))}),kt=function(){return dt.apply(Nt?ft.call(At(this)):At(this),arguments)},It={copyWithin:function(t,e){return D.call(At(this),t,e,arguments.length>2?arguments[2]:void 0)},every:function(t){return J(At(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return L.apply(At(this),arguments)},filter:function(t){return jt(this,Z(At(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return Q(At(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return tt(At(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){$(At(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return nt(At(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return et(At(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return ct.apply(At(this),arguments)},lastIndexOf:function(t){return at.apply(At(this),arguments)},map:function(t){return xt(At(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return st.apply(At(this),arguments)},reduceRight:function(t){return ut.apply(At(this),arguments)},reverse:function(){for(var t,e=this,n=At(e).length,r=Math.floor(n/2),o=0;o<r;)t=e[o],e[o++]=e[--n],e[n]=t;return e},some:function(t){return X(At(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return lt.call(At(this),t)},subarray:function(t,e){var n=At(this),r=n.length,o=v(t,r);return new(N(n,n[vt]))(n.buffer,n.byteOffset+o*n.BYTES_PER_ELEMENT,m((void 0===e?r:v(e,r))-o))}},Bt=function(t,e){return jt(this,ft.call(At(this),t,e))},Mt=function(t){At(this);var e=Ot(arguments[1],1),n=this.length,r=w(t),o=m(r.length),i=0;if(o+e>n)throw W("Wrong length!");for(;i<o;)this[e+i]=r[i++]},Lt={entries:function(){return it.call(At(this))},keys:function(){return ot.call(At(this))},values:function(){return rt.call(At(this))}},Dt=function(t,e){return x(t)&&t[yt]&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},Ft=function(t,e){return Dt(t,e=b(e,!0))?f(2,t[e]):U(t,e)},Gt=function(t,e,n){return!(Dt(t,e=b(e,!0))&&x(n)&&y(n,"value"))||y(n,"get")||y(n,"set")||n.configurable||y(n,"writable")&&!n.writable||y(n,"enumerable")&&!n.enumerable?z(t,e,n):(t[e]=n.value,t)};bt||(G.f=Ft,F.f=Gt),a(a.S+a.F*!bt,"Object",{getOwnPropertyDescriptor:Ft,defineProperty:Gt}),i(function(){pt.call({})})&&(pt=dt=function(){return ct.call(this)});var zt=d({},It);d(zt,Lt),p(zt,ht,Lt.values),d(zt,{slice:Bt,set:Mt,constructor:function(){},toString:pt,toLocaleString:kt}),Tt(zt,"buffer","b"),Tt(zt,"byteOffset","o"),Tt(zt,"byteLength","l"),Tt(zt,"length","e"),z(zt,mt,{get:function(){return this[yt]}}),e.exports=function(t,e,n,u){u=!!u;var c=t+(u?"Clamped":"")+"Array",f="get"+t,d="set"+t,h=o[c],v=h||{},b=h&&A(h),y=!h||!s.ABV,w={},S=h&&h.prototype,j=function(t,n){var r=t._d;return r.v[f](n*e+r.o,wt)},P=function(t,n,r){var o=t._d;u&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),o.v[d](n*e+o.o,r,wt)},T=function(t,e){z(t,e,{get:function(){return j(this,e)},set:function(t){return P(this,e,t)},enumerable:!0})};y?(h=n(function(t,n,r,o){l(t,h,c,"_d");var i,a,s,u,f=0,d=0;if(x(n)){if(!(n instanceof K||"ArrayBuffer"==(u=_(n))||"SharedArrayBuffer"==u))return yt in n?Pt(h,n):Ct.call(h,n);i=n,d=Ot(r,e);var v=n.byteLength;if(void 0===o){if(v%e)throw W("Wrong length!");if((a=v-d)<0)throw W("Wrong length!")}else if((a=m(o)*e)+d>v)throw W("Wrong length!");s=a/e}else s=g(n),a=s*e,i=new K(a);for(p(t,"_d",{b:i,o:d,l:a,e:s,v:new Y(i)});f<s;)T(t,f++)}),S=h.prototype=O(zt),p(S,"constructor",h)):i(function(){h(1)})&&i(function(){new h(-1)})&&B(function(t){new h,new h(null),new h(1.5),new h(t)},!0)||(h=n(function(t,n,r,o){l(t,h,c);var i;return x(n)?n instanceof K||"ArrayBuffer"==(i=_(n))||"SharedArrayBuffer"==i?void 0!==o?new v(n,Ot(r,e),o):void 0!==r?new v(n,Ot(r,e)):new v(n):yt in n?Pt(h,n):Ct.call(h,n):new v(g(n))}),$(b!==Function.prototype?E(v).concat(E(b)):E(v),function(t){t in h||p(h,t,v[t])}),h.prototype=S,r||(S.constructor=h));var C=S[ht],R=!!C&&("values"==C.name||void 0==C.name),N=Lt.values;p(h,gt,!0),p(S,yt,c),p(S,_t,!0),p(S,vt,h),(u?new h(1)[mt]==c:mt in S)||z(S,mt,{get:function(){return c}}),w[c]=h,a(a.G+a.W+a.F*(h!=v),w),a(a.S,c,{BYTES_PER_ELEMENT:e}),a(a.S+a.F*i(function(){v.of.call(h,1)}),c,{from:Ct,of:Rt}),"BYTES_PER_ELEMENT"in S||p(S,"BYTES_PER_ELEMENT",e),a(a.P,c,It),M(c),a(a.P+a.F*St,c,{set:Mt}),a(a.P+a.F*!R,c,Lt),r||S.toString==pt||(S.toString=pt),a(a.P+a.F*i(function(){new h(1).slice()}),c,{slice:Bt}),a(a.P+a.F*(i(function(){return[1,2].toLocaleString()!=new h([1,2]).toLocaleString()})||!i(function(){S.toLocaleString.call([1,2])})),c,{toLocaleString:kt}),I[c]=R?C:N,r||R||p(S,ht,N)}}else e.exports=function(){}},{"./_an-instance":5,"./_array-copy-within":7,"./_array-fill":8,"./_array-includes":9,"./_array-methods":10,"./_classof":14,"./_ctx":21,"./_descriptors":23,"./_export":27,"./_fails":29,"./_global":33,"./_has":34,"./_hide":35,"./_is-array-iter":41,"./_is-object":44,"./_iter-detect":49,"./_iterators":51,"./_library":52,"./_object-create":61,"./_object-dp":62,"./_object-gopd":64,"./_object-gopn":66,"./_object-gpo":68,"./_property-desc":76,"./_redefine-all":77,"./_set-species":81,"./_species-constructor":85,"./_to-absolute-index":91,"./_to-index":92,"./_to-integer":93,"./_to-length":95,"./_to-object":96,"./_to-primitive":97,"./_typed":100,"./_typed-buffer":99,"./_uid":101,"./_wks":105,"./core.get-iterator-method":106,"./es6.array.iterator":112}],99:[function(t,e,n){"use strict";function r(t,e,n){var r,o,i,a=Array(n),s=8*n-e-1,u=(1<<s)-1,c=u>>1,l=23===e?D(2,-24)-D(2,-77):0,f=0,p=t<0||0===t&&1/t<0?1:0;for(t=L(t),t!=t||t===B?(o=t!=t?1:0,r=u):(r=F(G(t)/z),t*(i=D(2,-r))<1&&(r--,i*=2),t+=r+c>=1?l/i:l*D(2,1-c),t*i>=2&&(r++,i/=2),r+c>=u?(o=0,r=u):r+c>=1?(o=(t*i-1)*D(2,e),r+=c):(o=t*D(2,c-1)*D(2,e),r=0));e>=8;a[f++]=255&o,o/=256,e-=8);for(r=r<<e|o,s+=e;s>0;a[f++]=255&r,r/=256,s-=8);return a[--f]|=128*p,a}function o(t,e,n){var r,o=8*n-e-1,i=(1<<o)-1,a=i>>1,s=o-7,u=n-1,c=t[u--],l=127&c;for(c>>=7;s>0;l=256*l+t[u],u--,s-=8);for(r=l&(1<<-s)-1,l>>=-s,s+=e;s>0;r=256*r+t[u],u--,s-=8);if(0===l)l=1-a;else{if(l===i)return r?NaN:c?-B:B;r+=D(2,e),l-=a}return(c?-1:1)*r*D(2,l-e)}function i(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function a(t){return[255&t]}function s(t){return[255&t,t>>8&255]}function u(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function c(t){return r(t,52,8)}function l(t){return r(t,23,4)}function f(t,e,n){E(t[T],e,{get:function(){return this[n]}})}function p(t,e,n,r){var o=+n,i=O(o);if(i+e>t[W])throw I(C);var a=t[U]._b,s=i+t[H],u=a.slice(s,s+e);return r?u:u.reverse()}function d(t,e,n,r,o,i){var a=+n,s=O(a);if(s+e>t[W])throw I(C);for(var u=t[U]._b,c=s+t[H],l=r(+o),f=0;f<e;f++)u[c+f]=l[i?f:e-f-1]}var h=t("./_global"),m=t("./_descriptors"),g=t("./_library"),v=t("./_typed"),b=t("./_hide"),y=t("./_redefine-all"),_=t("./_fails"),x=t("./_an-instance"),w=t("./_to-integer"),S=t("./_to-length"),O=t("./_to-index"),A=t("./_object-gopn").f,E=t("./_object-dp").f,j=t("./_array-fill"),P=t("./_set-to-string-tag"),T="prototype",C="Wrong index!",R=h.ArrayBuffer,N=h.DataView,k=h.Math,I=h.RangeError,B=h.Infinity,M=R,L=k.abs,D=k.pow,F=k.floor,G=k.log,z=k.LN2,U=m?"_b":"buffer",W=m?"_l":"byteLength",H=m?"_o":"byteOffset";if(v.ABV){if(!_(function(){R(1)})||!_(function(){new R(-1)})||_(function(){return new R,new R(1.5),new R(NaN),"ArrayBuffer"!=R.name})){R=function(t){return x(this,R),new M(O(t))};for(var V,q=R[T]=M[T],K=A(M),Y=0;K.length>Y;)(V=K[Y++])in R||b(R,V,M[V]);g||(q.constructor=R)}var $=new N(new R(2)),Z=N[T].setInt8;$.setInt8(0,2147483648),$.setInt8(1,2147483649),!$.getInt8(0)&&$.getInt8(1)||y(N[T],{setInt8:function(t,e){Z.call(this,t,e<<24>>24)},setUint8:function(t,e){Z.call(this,t,e<<24>>24)}},!0)}else R=function(t){x(this,R,"ArrayBuffer");var e=O(t);this._b=j.call(Array(e),0),this[W]=e},N=function(t,e,n){x(this,N,"DataView"),x(t,R,"DataView");var r=t[W],o=w(e);if(o<0||o>r)throw I("Wrong offset!");if(n=void 0===n?r-o:S(n),o+n>r)throw I("Wrong length!");this[U]=t,this[H]=o,this[W]=n},m&&(f(R,"byteLength","_l"),f(N,"buffer","_b"),f(N,"byteLength","_l"),f(N,"byteOffset","_o")),y(N[T],{getInt8:function(t){return p(this,1,t)[0]<<24>>24},getUint8:function(t){return p(this,1,t)[0]},getInt16:function(t){var e=p(this,2,t,arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=p(this,2,t,arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return i(p(this,4,t,arguments[1]))},getUint32:function(t){return i(p(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return o(p(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return o(p(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){d(this,1,t,a,e)},setUint8:function(t,e){d(this,1,t,a,e)},setInt16:function(t,e){d(this,2,t,s,e,arguments[2])},setUint16:function(t,e){d(this,2,t,s,e,arguments[2])},setInt32:function(t,e){d(this,4,t,u,e,arguments[2])},setUint32:function(t,e){d(this,4,t,u,e,arguments[2])},setFloat32:function(t,e){d(this,4,t,l,e,arguments[2])},setFloat64:function(t,e){d(this,8,t,c,e,arguments[2])}});P(R,"ArrayBuffer"),P(N,"DataView"),b(N[T],v.VIEW,!0),n.ArrayBuffer=R,n.DataView=N},{"./_an-instance":5,"./_array-fill":8,"./_descriptors":23,"./_fails":29,"./_global":33,"./_hide":35,"./_library":52,"./_object-dp":62,"./_object-gopn":66,"./_redefine-all":77,"./_set-to-string-tag":82,"./_to-index":92,"./_to-integer":93,"./_to-length":95,"./_typed":100}],100:[function(t,e,n){for(var r,o=t("./_global"),i=t("./_hide"),a=t("./_uid"),s=a("typed_array"),u=a("view"),c=!(!o.ArrayBuffer||!o.DataView),l=c,f=0,p="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");f<9;)(r=o[p[f++]])?(i(r.prototype,s,!0),i(r.prototype,u,!0)):l=!1;e.exports={ABV:c,CONSTR:l,TYPED:s,VIEW:u}},{"./_global":33,"./_hide":35,"./_uid":101}],101:[function(t,e,n){var r=0,o=Math.random();e.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+o).toString(36))}},{}],102:[function(t,e,n){var r=t("./_is-object");e.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},{"./_is-object":44}],103:[function(t,e,n){var r=t("./_global"),o=t("./_core"),i=t("./_library"),a=t("./_wks-ext"),s=t("./_object-dp").f;e.exports=function(t){var e=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||s(e,t,{value:a.f(t)})}},{"./_core":19,"./_global":33,"./_library":52,"./_object-dp":62,"./_wks-ext":104}],104:[function(t,e,n){n.f=t("./_wks")},{"./_wks":105}],105:[function(t,e,n){var r=t("./_shared")("wks"),o=t("./_uid"),i=t("./_global").Symbol,a="function"==typeof i;(e.exports=function(t){return r[t]||(r[t]=a&&i[t]||(a?i:o)("Symbol."+t))}).store=r},{"./_global":33,"./_shared":84,"./_uid":101}],106:[function(t,e,n){var r=t("./_classof"),o=t("./_wks")("iterator"),i=t("./_iterators");e.exports=t("./_core").getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[r(t)]}},{"./_classof":14,"./_core":19,"./_iterators":51,"./_wks":105}],107:[function(t,e,n){var r=t("./_export");r(r.P,"Array",{copyWithin:t("./_array-copy-within")}),t("./_add-to-unscopables")("copyWithin")},{"./_add-to-unscopables":4,"./_array-copy-within":7,"./_export":27}],108:[function(t,e,n){var r=t("./_export");r(r.P,"Array",{fill:t("./_array-fill")}),t("./_add-to-unscopables")("fill")},{"./_add-to-unscopables":4,"./_array-fill":8,"./_export":27}],109:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_array-methods")(6),i="findIndex",a=!0;i in[]&&Array(1)[i](function(){a=!1}),r(r.P+r.F*a,"Array",{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),t("./_add-to-unscopables")(i)},{"./_add-to-unscopables":4,"./_array-methods":10,"./_export":27}],110:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_array-methods")(5),i=!0;"find"in[]&&Array(1).find(function(){i=!1}),r(r.P+r.F*i,"Array",{find:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),t("./_add-to-unscopables")("find")},{"./_add-to-unscopables":4,"./_array-methods":10,"./_export":27}],111:[function(t,e,n){"use strict";var r=t("./_ctx"),o=t("./_export"),i=t("./_to-object"),a=t("./_iter-call"),s=t("./_is-array-iter"),u=t("./_to-length"),c=t("./_create-property"),l=t("./core.get-iterator-method");o(o.S+o.F*!t("./_iter-detect")(function(t){Array.from(t)}),"Array",{from:function(t){var e,n,o,f,p=i(t),d="function"==typeof this?this:Array,h=arguments.length,m=h>1?arguments[1]:void 0,g=void 0!==m,v=0,b=l(p);if(g&&(m=r(m,h>2?arguments[2]:void 0,2)),void 0==b||d==Array&&s(b))for(e=u(p.length),n=new d(e);e>v;v++)c(n,v,g?m(p[v],v):p[v]);else for(f=b.call(p),n=new d;!(o=f.next()).done;v++)c(n,v,g?a(f,m,[o.value,v],!0):o.value);return n.length=v,n}})},{"./_create-property":20,"./_ctx":21,"./_export":27,"./_is-array-iter":41,"./_iter-call":46,"./_iter-detect":49,"./_to-length":95,"./_to-object":96,"./core.get-iterator-method":106}],112:[function(t,e,n){"use strict";var r=t("./_add-to-unscopables"),o=t("./_iter-step"),i=t("./_iterators"),a=t("./_to-iobject");e.exports=t("./_iter-define")(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):"keys"==e?o(0,n):"values"==e?o(0,t[n]):o(0,[n,t[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},{"./_add-to-unscopables":4,"./_iter-define":48,"./_iter-step":50,"./_iterators":51,"./_to-iobject":94}],113:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_create-property");r(r.S+r.F*t("./_fails")(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,e=arguments.length,n=new("function"==typeof this?this:Array)(e);e>t;)o(n,t,arguments[t++]);return n.length=e,n}})},{"./_create-property":20,"./_export":27,"./_fails":29}],114:[function(t,e,n){var r=t("./_object-dp").f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||t("./_descriptors")&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(t){return""}}})},{"./_descriptors":23,"./_object-dp":62}],115:[function(t,e,n){"use strict";var r=t("./_collection-strong"),o=t("./_validate-collection");e.exports=t("./_collection")("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var e=r.getEntry(o(this,"Map"),t);return e&&e.v},set:function(t,e){return r.def(o(this,"Map"),0===t?0:t,e)}},r,!0)},{"./_collection":18,"./_collection-strong":16,"./_validate-collection":102}],116:[function(t,e,n){var r=t("./_export"),o=t("./_math-log1p"),i=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:o(t-1+i(t-1)*i(t+1))}})},{"./_export":27,"./_math-log1p":55}],117:[function(t,e,n){function r(t){return isFinite(t=+t)&&0!=t?t<0?-r(-t):Math.log(t+Math.sqrt(t*t+1)):t}var o=t("./_export"),i=Math.asinh;o(o.S+o.F*!(i&&1/i(0)>0),"Math",{asinh:r})},{"./_export":27}],118:[function(t,e,n){var r=t("./_export"),o=Math.atanh;r(r.S+r.F*!(o&&1/o(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},{"./_export":27}],119:[function(t,e,n){var r=t("./_export"),o=t("./_math-sign");r(r.S,"Math",{cbrt:function(t){return o(t=+t)*Math.pow(Math.abs(t),1/3)}})},{"./_export":27,"./_math-sign":56}],120:[function(t,e,n){var r=t("./_export");r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},{"./_export":27}],121:[function(t,e,n){var r=t("./_export"),o=Math.exp;r(r.S,"Math",{cosh:function(t){return(o(t=+t)+o(-t))/2}})},{"./_export":27}],122:[function(t,e,n){var r=t("./_export"),o=t("./_math-expm1");r(r.S+r.F*(o!=Math.expm1),"Math",{expm1:o})},{"./_export":27,"./_math-expm1":53}],123:[function(t,e,n){var r=t("./_export");r(r.S,"Math",{fround:t("./_math-fround")})},{"./_export":27,"./_math-fround":54}],124:[function(t,e,n){var r=t("./_export"),o=Math.abs;r(r.S,"Math",{hypot:function(t,e){for(var n,r,i=0,a=0,s=arguments.length,u=0;a<s;)n=o(arguments[a++]),u<n?(r=u/n,i=i*r*r+1,u=n):n>0?(r=n/u,i+=r*r):i+=n;return u===1/0?1/0:u*Math.sqrt(i)}})},{"./_export":27}],125:[function(t,e,n){var r=t("./_export"),o=Math.imul;r(r.S+r.F*t("./_fails")(function(){return-5!=o(4294967295,5)||2!=o.length}),"Math",{imul:function(t,e){var n=+t,r=+e,o=65535&n,i=65535&r;return 0|o*i+((65535&n>>>16)*i+o*(65535&r>>>16)<<16>>>0)}})},{"./_export":27,"./_fails":29}],126:[function(t,e,n){var r=t("./_export");r(r.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},{"./_export":27}],127:[function(t,e,n){var r=t("./_export");r(r.S,"Math",{log1p:t("./_math-log1p")})},{"./_export":27,"./_math-log1p":55}],128:[function(t,e,n){var r=t("./_export");r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},{"./_export":27}],129:[function(t,e,n){var r=t("./_export");r(r.S,"Math",{sign:t("./_math-sign")})},{"./_export":27,"./_math-sign":56}],130:[function(t,e,n){var r=t("./_export"),o=t("./_math-expm1"),i=Math.exp;r(r.S+r.F*t("./_fails")(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(o(t)-o(-t))/2:(i(t-1)-i(-t-1))*(Math.E/2)}})},{"./_export":27,"./_fails":29,"./_math-expm1":53}],131:[function(t,e,n){var r=t("./_export"),o=t("./_math-expm1"),i=Math.exp;r(r.S,"Math",{tanh:function(t){var e=o(t=+t),n=o(-t);return e==1/0?1:n==1/0?-1:(e-n)/(i(t)+i(-t))}})},{"./_export":27,"./_math-expm1":53}],132:[function(t,e,n){var r=t("./_export");r(r.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},{"./_export":27}],133:[function(t,e,n){var r=t("./_export");r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},{"./_export":27}],134:[function(t,e,n){var r=t("./_export"),o=t("./_global").isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&o(t)}})},{"./_export":27,"./_global":33}],135:[function(t,e,n){var r=t("./_export");r(r.S,"Number",{isInteger:t("./_is-integer")})},{"./_export":27,"./_is-integer":43}],136:[function(t,e,n){var r=t("./_export");r(r.S,"Number",{isNaN:function(t){return t!=t}})},{"./_export":27}],137:[function(t,e,n){var r=t("./_export"),o=t("./_is-integer"),i=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return o(t)&&i(t)<=9007199254740991}})},{"./_export":27,"./_is-integer":43}],138:[function(t,e,n){var r=t("./_export");r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{"./_export":27}],139:[function(t,e,n){var r=t("./_export");r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{"./_export":27}],140:[function(t,e,n){var r=t("./_export");r(r.S+r.F,"Object",{assign:t("./_object-assign")})},{"./_export":27,"./_object-assign":60}],141:[function(t,e,n){var r=t("./_export");r(r.S,"Object",{is:t("./_same-value")})},{"./_export":27,"./_same-value":79}],142:[function(t,e,n){var r=t("./_export");r(r.S,"Object",{setPrototypeOf:t("./_set-proto").set})},{"./_export":27,"./_set-proto":80}],143:[function(t,e,n){"use strict";var r,o,i,a,s=t("./_library"),u=t("./_global"),c=t("./_ctx"),l=t("./_classof"),f=t("./_export"),p=t("./_is-object"),d=t("./_a-function"),h=t("./_an-instance"),m=t("./_for-of"),g=t("./_species-constructor"),v=t("./_task").set,b=t("./_microtask")(),y=t("./_new-promise-capability"),_=t("./_perform"),x=t("./_promise-resolve"),w=u.TypeError,S=u.process,O=u.Promise,A="process"==l(S),E=function(){},j=o=y.f,P=!!function(){try{var e=O.resolve(1),n=(e.constructor={})[t("./_wks")("species")]=function(t){t(E,E)};return(A||"function"==typeof PromiseRejectionEvent)&&e.then(E)instanceof n}catch(t){}}(),T=function(t){var e;return!(!p(t)||"function"!=typeof(e=t.then))&&e},C=function(t,e){if(!t._n){t._n=!0;var n=t._c;b(function(){for(var r=t._v,o=1==t._s,i=0;n.length>i;)!function(e){var n,i,a=o?e.ok:e.fail,s=e.resolve,u=e.reject,c=e.domain;try{a?(o||(2==t._h&&k(t),t._h=1),!0===a?n=r:(c&&c.enter(),n=a(r),c&&c.exit()),n===e.promise?u(w("Promise-chain cycle")):(i=T(n))?i.call(n,s,u):s(n)):u(r)}catch(t){u(t)}}(n[i++]);t._c=[],t._n=!1,e&&!t._h&&R(t)})}},R=function(t){v.call(u,function(){var e,n,r,o=t._v,i=N(t);if(i&&(e=_(function(){A?S.emit("unhandledRejection",o,t):(n=u.onunhandledrejection)?n({promise:t,reason:o}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",o)}),t._h=A||N(t)?2:1),t._a=void 0,i&&e.e)throw e.v})},N=function(t){if(1==t._h)return!1;for(var e,n=t._a||t._c,r=0;n.length>r;)if(e=n[r++],e.fail||!N(e.promise))return!1;return!0},k=function(t){v.call(u,function(){var e;A?S.emit("rejectionHandled",t):(e=u.onrejectionhandled)&&e({promise:t,reason:t._v})})},I=function(t){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=t,e._s=2,e._a||(e._a=e._c.slice()),C(e,!0))},B=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw w("Promise can't be resolved itself");(e=T(t))?b(function(){var r={_w:n,_d:!1};try{e.call(t,c(B,r,1),c(I,r,1))}catch(t){I.call(r,t)}}):(n._v=t,n._s=1,C(n,!1))}catch(t){I.call({_w:n,_d:!1},t)}}};P||(O=function(t){h(this,O,"Promise","_h"),d(t),r.call(this);try{t(c(B,this,1),c(I,this,1))}catch(t){I.call(this,t)}},r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=t("./_redefine-all")(O.prototype,{then:function(t,e){var n=j(g(this,O));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=A?S.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&C(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new r;this.promise=t,this.resolve=c(B,t,1),this.reject=c(I,t,1)},y.f=j=function(t){return t===O||t===a?new i(t):o(t)}),f(f.G+f.W+f.F*!P,{Promise:O}),t("./_set-to-string-tag")(O,"Promise"),t("./_set-species")("Promise"),a=t("./_core").Promise,f(f.S+f.F*!P,"Promise",{reject:function(t){var e=j(this);return(0,e.reject)(t),e.promise}}),f(f.S+f.F*(s||!P),"Promise",{resolve:function(t){return x(s&&this===a?O:this,t)}}),f(f.S+f.F*!(P&&t("./_iter-detect")(function(t){O.all(t).catch(E)})),"Promise",{all:function(t){var e=this,n=j(e),r=n.resolve,o=n.reject,i=_(function(){var n=[],i=0,a=1;m(t,!1,function(t){var s=i++,u=!1;n.push(void 0),a++,e.resolve(t).then(function(t){u||(u=!0,n[s]=t,--a||r(n))},o)}),--a||r(n)});return i.e&&o(i.v),n.promise},race:function(t){var e=this,n=j(e),r=n.reject,o=_(function(){m(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return o.e&&r(o.v),n.promise}})},{"./_a-function":3,"./_an-instance":5,"./_classof":14,"./_core":19,"./_ctx":21,"./_export":27,"./_for-of":32,"./_global":33,"./_is-object":44,"./_iter-detect":49,"./_library":52,"./_microtask":58,"./_new-promise-capability":59,"./_perform":74,"./_promise-resolve":75,"./_redefine-all":77,"./_set-species":81,"./_set-to-string-tag":82,"./_species-constructor":85,"./_task":90,"./_wks":105}],144:[function(t,e,n){var r=t("./_export"),o=t("./_a-function"),i=t("./_an-object"),a=(t("./_global").Reflect||{}).apply,s=Function.apply;r(r.S+r.F*!t("./_fails")(function(){a(function(){})}),"Reflect",{apply:function(t,e,n){var r=o(t),u=i(n);return a?a(r,e,u):s.call(r,e,u)}})},{"./_a-function":3,"./_an-object":6,"./_export":27,"./_fails":29,"./_global":33}],145:[function(t,e,n){var r=t("./_export"),o=t("./_object-create"),i=t("./_a-function"),a=t("./_an-object"),s=t("./_is-object"),u=t("./_fails"),c=t("./_bind"),l=(t("./_global").Reflect||{}).construct,f=u(function(){function t(){}return!(l(function(){},[],t)instanceof t)}),p=!u(function(){l(function(){})});r(r.S+r.F*(f||p),"Reflect",{construct:function(t,e){i(t),a(e);var n=arguments.length<3?t:i(arguments[2]);if(p&&!f)return l(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(c.apply(t,r))}var u=n.prototype,d=o(s(u)?u:Object.prototype),h=Function.apply.call(t,d,e);return s(h)?h:d}})},{"./_a-function":3,"./_an-object":6,"./_bind":13,"./_export":27,"./_fails":29,"./_global":33,"./_is-object":44,"./_object-create":61}],146:[function(t,e,n){var r=t("./_object-dp"),o=t("./_export"),i=t("./_an-object"),a=t("./_to-primitive");o(o.S+o.F*t("./_fails")(function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,e,n){i(t),e=a(e,!0),i(n);try{return r.f(t,e,n),!0}catch(t){return!1}}})},{"./_an-object":6,"./_export":27,"./_fails":29,"./_object-dp":62,"./_to-primitive":97}],147:[function(t,e,n){var r=t("./_export"),o=t("./_object-gopd").f,i=t("./_an-object");r(r.S,"Reflect",{deleteProperty:function(t,e){var n=o(i(t),e);return!(n&&!n.configurable)&&delete t[e]}})},{"./_an-object":6,"./_export":27,"./_object-gopd":64}],148:[function(t,e,n){var r=t("./_object-gopd"),o=t("./_export"),i=t("./_an-object");o(o.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return r.f(i(t),e)}})},{"./_an-object":6,"./_export":27,"./_object-gopd":64}],149:[function(t,e,n){var r=t("./_export"),o=t("./_object-gpo"),i=t("./_an-object");r(r.S,"Reflect",{getPrototypeOf:function(t){return o(i(t))}})},{"./_an-object":6,"./_export":27,"./_object-gpo":68}],150:[function(t,e,n){function r(t,e){var n,s,l=arguments.length<3?t:arguments[2];return c(t)===l?t[e]:(n=o.f(t,e))?a(n,"value")?n.value:void 0!==n.get?n.get.call(l):void 0:u(s=i(t))?r(s,e,l):void 0}var o=t("./_object-gopd"),i=t("./_object-gpo"),a=t("./_has"),s=t("./_export"),u=t("./_is-object"),c=t("./_an-object");s(s.S,"Reflect",{get:r})},{"./_an-object":6,"./_export":27,"./_has":34,"./_is-object":44,"./_object-gopd":64,"./_object-gpo":68}],151:[function(t,e,n){var r=t("./_export");r(r.S,"Reflect",{has:function(t,e){return e in t}})},{"./_export":27}],152:[function(t,e,n){var r=t("./_export"),o=t("./_an-object"),i=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return o(t),!i||i(t)}})},{"./_an-object":6,"./_export":27}],153:[function(t,e,n){var r=t("./_export");r(r.S,"Reflect",{ownKeys:t("./_own-keys")})},{"./_export":27,"./_own-keys":73}],154:[function(t,e,n){var r=t("./_export"),o=t("./_an-object"),i=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){o(t);try{return i&&i(t),!0}catch(t){return!1}}})},{"./_an-object":6,"./_export":27}],155:[function(t,e,n){var r=t("./_export"),o=t("./_set-proto");o&&r(r.S,"Reflect",{setPrototypeOf:function(t,e){o.check(t,e);try{return o.set(t,e),!0}catch(t){return!1}}})},{"./_export":27,"./_set-proto":80}],156:[function(t,e,n){function r(t,e,n){var u,p,d=arguments.length<4?t:arguments[3],h=i.f(l(t),e);if(!h){if(f(p=a(t)))return r(p,e,n,d);h=c(0)}return s(h,"value")?!(!1===h.writable||!f(d))&&(u=i.f(d,e)||c(0),u.value=n,o.f(d,e,u),!0):void 0!==h.set&&(h.set.call(d,n),!0)}var o=t("./_object-dp"),i=t("./_object-gopd"),a=t("./_object-gpo"),s=t("./_has"),u=t("./_export"),c=t("./_property-desc"),l=t("./_an-object"),f=t("./_is-object");u(u.S,"Reflect",{set:r})},{"./_an-object":6,"./_export":27,"./_has":34,"./_is-object":44,"./_object-dp":62,"./_object-gopd":64,"./_object-gpo":68,"./_property-desc":76}],157:[function(t,e,n){t("./_descriptors")&&"g"!=/./g.flags&&t("./_object-dp").f(RegExp.prototype,"flags",{configurable:!0,get:t("./_flags")})},{"./_descriptors":23,"./_flags":31,"./_object-dp":62}],158:[function(t,e,n){t("./_fix-re-wks")("match",1,function(t,e,n){return[function(n){"use strict";var r=t(this),o=void 0==n?void 0:n[e];return void 0!==o?o.call(n,r):new RegExp(n)[e](String(r))},n]})},{"./_fix-re-wks":30}],159:[function(t,e,n){t("./_fix-re-wks")("replace",2,function(t,e,n){return[function(r,o){"use strict";var i=t(this),a=void 0==r?void 0:r[e];return void 0!==a?a.call(r,i,o):n.call(String(i),r,o)},n]})},{"./_fix-re-wks":30}],160:[function(t,e,n){t("./_fix-re-wks")("search",1,function(t,e,n){return[function(n){"use strict";var r=t(this),o=void 0==n?void 0:n[e];return void 0!==o?o.call(n,r):new RegExp(n)[e](String(r))},n]})},{"./_fix-re-wks":30}],161:[function(t,e,n){t("./_fix-re-wks")("split",2,function(e,n,r){"use strict";var o=t("./_is-regexp"),i=r,a=[].push,s="length";if("c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1)[s]||2!="ab".split(/(?:ab)*/)[s]||4!=".".split(/(.?)(.?)/)[s]||".".split(/()()/)[s]>1||"".split(/.?/)[s]){var u=void 0===/()??/.exec("")[1];r=function(t,e){var n=String(this);if(void 0===t&&0===e)return[];if(!o(t))return i.call(n,t,e);var r,c,l,f,p,d=[],h=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),m=0,g=void 0===e?4294967295:e>>>0,v=new RegExp(t.source,h+"g");for(u||(r=new RegExp("^"+v.source+"$(?!\\s)",h));(c=v.exec(n))&&!((l=c.index+c[0][s])>m&&(d.push(n.slice(m,c.index)),!u&&c[s]>1&&c[0].replace(r,function(){for(p=1;p<arguments[s]-2;p++)void 0===arguments[p]&&(c[p]=void 0)}),c[s]>1&&c.index<n[s]&&a.apply(d,c.slice(1)),f=c[0][s],m=l,d[s]>=g));)v.lastIndex===c.index&&v.lastIndex++;return m===n[s]?!f&&v.test("")||d.push(""):d.push(n.slice(m)),d[s]>g?d.slice(0,g):d}}else"0".split(void 0,0)[s]&&(r=function(t,e){return void 0===t&&0===e?[]:i.call(this,t,e)});return[function(t,o){var i=e(this),a=void 0==t?void 0:t[n];return void 0!==a?a.call(t,i,o):r.call(String(i),t,o)},r]})},{"./_fix-re-wks":30,"./_is-regexp":45}],162:[function(t,e,n){"use strict";var r=t("./_collection-strong"),o=t("./_validate-collection");e.exports=t("./_collection")("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(o(this,"Set"),t=0===t?0:t,t)}},r)},{"./_collection":18,"./_collection-strong":16,"./_validate-collection":102}],163:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_string-at")(!1);r(r.P,"String",{codePointAt:function(t){return o(this,t)}})},{"./_export":27,"./_string-at":86}],164:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_to-length"),i=t("./_string-context"),a="".endsWith
;r(r.P+r.F*t("./_fails-is-regexp")("endsWith"),"String",{endsWith:function(t){var e=i(this,t,"endsWith"),n=arguments.length>1?arguments[1]:void 0,r=o(e.length),s=void 0===n?r:Math.min(o(n),r),u=String(t);return a?a.call(e,u,s):e.slice(s-u.length,s)===u}})},{"./_export":27,"./_fails-is-regexp":28,"./_string-context":87,"./_to-length":95}],165:[function(t,e,n){var r=t("./_export"),o=t("./_to-absolute-index"),i=String.fromCharCode,a=String.fromCodePoint;r(r.S+r.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,a=0;r>a;){if(e=+arguments[a++],o(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?i(e):i(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}})},{"./_export":27,"./_to-absolute-index":91}],166:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_string-context");r(r.P+r.F*t("./_fails-is-regexp")("includes"),"String",{includes:function(t){return!!~o(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},{"./_export":27,"./_fails-is-regexp":28,"./_string-context":87}],167:[function(t,e,n){var r=t("./_export"),o=t("./_to-iobject"),i=t("./_to-length");r(r.S,"String",{raw:function(t){for(var e=o(t.raw),n=i(e.length),r=arguments.length,a=[],s=0;n>s;)a.push(String(e[s++])),s<r&&a.push(String(arguments[s]));return a.join("")}})},{"./_export":27,"./_to-iobject":94,"./_to-length":95}],168:[function(t,e,n){var r=t("./_export");r(r.P,"String",{repeat:t("./_string-repeat")})},{"./_export":27,"./_string-repeat":89}],169:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_to-length"),i=t("./_string-context"),a="".startsWith;r(r.P+r.F*t("./_fails-is-regexp")("startsWith"),"String",{startsWith:function(t){var e=i(this,t,"startsWith"),n=o(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return a?a.call(e,r,n):e.slice(n,n+r.length)===r}})},{"./_export":27,"./_fails-is-regexp":28,"./_string-context":87,"./_to-length":95}],170:[function(t,e,n){"use strict";var r=t("./_global"),o=t("./_has"),i=t("./_descriptors"),a=t("./_export"),s=t("./_redefine"),u=t("./_meta").KEY,c=t("./_fails"),l=t("./_shared"),f=t("./_set-to-string-tag"),p=t("./_uid"),d=t("./_wks"),h=t("./_wks-ext"),m=t("./_wks-define"),g=t("./_enum-keys"),v=t("./_is-array"),b=t("./_an-object"),y=t("./_to-iobject"),_=t("./_to-primitive"),x=t("./_property-desc"),w=t("./_object-create"),S=t("./_object-gopn-ext"),O=t("./_object-gopd"),A=t("./_object-dp"),E=t("./_object-keys"),j=O.f,P=A.f,T=S.f,C=r.Symbol,R=r.JSON,N=R&&R.stringify,k=d("_hidden"),I=d("toPrimitive"),B={}.propertyIsEnumerable,M=l("symbol-registry"),L=l("symbols"),D=l("op-symbols"),F=Object.prototype,G="function"==typeof C,z=r.QObject,U=!z||!z.prototype||!z.prototype.findChild,W=i&&c(function(){return 7!=w(P({},"a",{get:function(){return P(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=j(F,e);r&&delete F[e],P(t,e,n),r&&t!==F&&P(F,e,r)}:P,H=function(t){var e=L[t]=w(C.prototype);return e._k=t,e},V=G&&"symbol"==typeof C.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof C},q=function(t,e,n){return t===F&&q(D,e,n),b(t),e=_(e,!0),b(n),o(L,e)?(n.enumerable?(o(t,k)&&t[k][e]&&(t[k][e]=!1),n=w(n,{enumerable:x(0,!1)})):(o(t,k)||P(t,k,x(1,{})),t[k][e]=!0),W(t,e,n)):P(t,e,n)},K=function(t,e){b(t);for(var n,r=g(e=y(e)),o=0,i=r.length;i>o;)q(t,n=r[o++],e[n]);return t},Y=function(t,e){return void 0===e?w(t):K(w(t),e)},$=function(t){var e=B.call(this,t=_(t,!0));return!(this===F&&o(L,t)&&!o(D,t))&&(!(e||!o(this,t)||!o(L,t)||o(this,k)&&this[k][t])||e)},Z=function(t,e){if(t=y(t),e=_(e,!0),t!==F||!o(L,e)||o(D,e)){var n=j(t,e);return!n||!o(L,e)||o(t,k)&&t[k][e]||(n.enumerable=!0),n}},X=function(t){for(var e,n=T(y(t)),r=[],i=0;n.length>i;)o(L,e=n[i++])||e==k||e==u||r.push(e);return r},J=function(t){for(var e,n=t===F,r=T(n?D:y(t)),i=[],a=0;r.length>a;)!o(L,e=r[a++])||n&&!o(F,e)||i.push(L[e]);return i};G||(C=function(){if(this instanceof C)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(n){this===F&&e.call(D,n),o(this,k)&&o(this[k],t)&&(this[k][t]=!1),W(this,t,x(1,n))};return i&&U&&W(F,t,{configurable:!0,set:e}),H(t)},s(C.prototype,"toString",function(){return this._k}),O.f=Z,A.f=q,t("./_object-gopn").f=S.f=X,t("./_object-pie").f=$,t("./_object-gops").f=J,i&&!t("./_library")&&s(F,"propertyIsEnumerable",$,!0),h.f=function(t){return H(d(t))}),a(a.G+a.W+a.F*!G,{Symbol:C});for(var Q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Q.length>tt;)d(Q[tt++]);for(var et=E(d.store),nt=0;et.length>nt;)m(et[nt++]);a(a.S+a.F*!G,"Symbol",{for:function(t){return o(M,t+="")?M[t]:M[t]=C(t)},keyFor:function(t){if(!V(t))throw TypeError(t+" is not a symbol!");for(var e in M)if(M[e]===t)return e},useSetter:function(){U=!0},useSimple:function(){U=!1}}),a(a.S+a.F*!G,"Object",{create:Y,defineProperty:q,defineProperties:K,getOwnPropertyDescriptor:Z,getOwnPropertyNames:X,getOwnPropertySymbols:J}),R&&a(a.S+a.F*(!G||c(function(){var t=C();return"[null]"!=N([t])||"{}"!=N({a:t})||"{}"!=N(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!V(t)){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);return e=r[1],"function"==typeof e&&(n=e),!n&&v(e)||(e=function(t,e){if(n&&(e=n.call(this,t,e)),!V(e))return e}),r[1]=e,N.apply(R,r)}}}),C.prototype[I]||t("./_hide")(C.prototype,I,C.prototype.valueOf),f(C,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},{"./_an-object":6,"./_descriptors":23,"./_enum-keys":26,"./_export":27,"./_fails":29,"./_global":33,"./_has":34,"./_hide":35,"./_is-array":42,"./_library":52,"./_meta":57,"./_object-create":61,"./_object-dp":62,"./_object-gopd":64,"./_object-gopn":66,"./_object-gopn-ext":65,"./_object-gops":67,"./_object-keys":70,"./_object-pie":71,"./_property-desc":76,"./_redefine":78,"./_set-to-string-tag":82,"./_shared":84,"./_to-iobject":94,"./_to-primitive":97,"./_uid":101,"./_wks":105,"./_wks-define":103,"./_wks-ext":104}],171:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_typed"),i=t("./_typed-buffer"),a=t("./_an-object"),s=t("./_to-absolute-index"),u=t("./_to-length"),c=t("./_is-object"),l=t("./_global").ArrayBuffer,f=t("./_species-constructor"),p=i.ArrayBuffer,d=i.DataView,h=o.ABV&&l.isView,m=p.prototype.slice,g=o.VIEW;r(r.G+r.W+r.F*(l!==p),{ArrayBuffer:p}),r(r.S+r.F*!o.CONSTR,"ArrayBuffer",{isView:function(t){return h&&h(t)||c(t)&&g in t}}),r(r.P+r.U+r.F*t("./_fails")(function(){return!new p(2).slice(1,void 0).byteLength}),"ArrayBuffer",{slice:function(t,e){if(void 0!==m&&void 0===e)return m.call(a(this),t);for(var n=a(this).byteLength,r=s(t,n),o=s(void 0===e?n:e,n),i=new(f(this,p))(u(o-r)),c=new d(this),l=new d(i),h=0;r<o;)l.setUint8(h++,c.getUint8(r++));return i}}),t("./_set-species")("ArrayBuffer")},{"./_an-object":6,"./_export":27,"./_fails":29,"./_global":33,"./_is-object":44,"./_set-species":81,"./_species-constructor":85,"./_to-absolute-index":91,"./_to-length":95,"./_typed":100,"./_typed-buffer":99}],172:[function(t,e,n){t("./_typed-array")("Float32",4,function(t){return function(e,n,r){return t(this,e,n,r)}})},{"./_typed-array":98}],173:[function(t,e,n){t("./_typed-array")("Float64",8,function(t){return function(e,n,r){return t(this,e,n,r)}})},{"./_typed-array":98}],174:[function(t,e,n){t("./_typed-array")("Int16",2,function(t){return function(e,n,r){return t(this,e,n,r)}})},{"./_typed-array":98}],175:[function(t,e,n){t("./_typed-array")("Int32",4,function(t){return function(e,n,r){return t(this,e,n,r)}})},{"./_typed-array":98}],176:[function(t,e,n){t("./_typed-array")("Int8",1,function(t){return function(e,n,r){return t(this,e,n,r)}})},{"./_typed-array":98}],177:[function(t,e,n){t("./_typed-array")("Uint16",2,function(t){return function(e,n,r){return t(this,e,n,r)}})},{"./_typed-array":98}],178:[function(t,e,n){t("./_typed-array")("Uint32",4,function(t){return function(e,n,r){return t(this,e,n,r)}})},{"./_typed-array":98}],179:[function(t,e,n){t("./_typed-array")("Uint8",1,function(t){return function(e,n,r){return t(this,e,n,r)}})},{"./_typed-array":98}],180:[function(t,e,n){t("./_typed-array")("Uint8",1,function(t){return function(e,n,r){return t(this,e,n,r)}},!0)},{"./_typed-array":98}],181:[function(t,e,n){"use strict";var r,o=t("./_array-methods")(0),i=t("./_redefine"),a=t("./_meta"),s=t("./_object-assign"),u=t("./_collection-weak"),c=t("./_is-object"),l=t("./_fails"),f=t("./_validate-collection"),p=a.getWeak,d=Object.isExtensible,h=u.ufstore,m={},g=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},v={get:function(t){if(c(t)){var e=p(t);return!0===e?h(f(this,"WeakMap")).get(t):e?e[this._i]:void 0}},set:function(t,e){return u.def(f(this,"WeakMap"),t,e)}},b=e.exports=t("./_collection")("WeakMap",g,v,u,!0,!0);l(function(){return 7!=(new b).set((Object.freeze||Object)(m),7).get(m)})&&(r=u.getConstructor(g,"WeakMap"),s(r.prototype,v),a.NEED=!0,o(["delete","has","get","set"],function(t){var e=b.prototype,n=e[t];i(e,t,function(e,o){if(c(e)&&!d(e)){this._f||(this._f=new r);var i=this._f[t](e,o);return"set"==t?this:i}return n.call(this,e,o)})}))},{"./_array-methods":10,"./_collection":18,"./_collection-weak":17,"./_fails":29,"./_is-object":44,"./_meta":57,"./_object-assign":60,"./_redefine":78,"./_validate-collection":102}],182:[function(t,e,n){"use strict";var r=t("./_collection-weak"),o=t("./_validate-collection");t("./_collection")("WeakSet",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(o(this,"WeakSet"),t,!0)}},r,!1,!0)},{"./_collection":18,"./_collection-weak":17,"./_validate-collection":102}],183:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_array-includes")(!0);r(r.P,"Array",{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),t("./_add-to-unscopables")("includes")},{"./_add-to-unscopables":4,"./_array-includes":9,"./_export":27}],184:[function(t,e,n){var r=t("./_export"),o=t("./_object-to-array")(!0);r(r.S,"Object",{entries:function(t){return o(t)}})},{"./_export":27,"./_object-to-array":72}],185:[function(t,e,n){var r=t("./_export"),o=t("./_own-keys"),i=t("./_to-iobject"),a=t("./_object-gopd"),s=t("./_create-property");r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n,r=i(t),u=a.f,c=o(r),l={},f=0;c.length>f;)void 0!==(n=u(r,e=c[f++]))&&s(l,e,n);return l}})},{"./_create-property":20,"./_export":27,"./_object-gopd":64,"./_own-keys":73,"./_to-iobject":94}],186:[function(t,e,n){var r=t("./_export"),o=t("./_object-to-array")(!1);r(r.S,"Object",{values:function(t){return o(t)}})},{"./_export":27,"./_object-to-array":72}],187:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_string-pad");r(r.P,"String",{padEnd:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},{"./_export":27,"./_string-pad":88}],188:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_string-pad");r(r.P,"String",{padStart:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},{"./_export":27,"./_string-pad":88}],189:[function(t,e,n){for(var r=t("./es6.array.iterator"),o=t("./_object-keys"),i=t("./_redefine"),a=t("./_global"),s=t("./_hide"),u=t("./_iterators"),c=t("./_wks"),l=c("iterator"),f=c("toStringTag"),p=u.Array,d={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=o(d),m=0;m<h.length;m++){var g,v=h[m],b=d[v],y=a[v],_=y&&y.prototype;if(_&&(_[l]||s(_,l,p),_[f]||s(_,f,v),u[v]=p,b))for(g in r)_[g]||i(_,g,r[g],!0)}},{"./_global":33,"./_hide":35,"./_iterators":51,"./_object-keys":70,"./_redefine":78,"./_wks":105,"./es6.array.iterator":112}],190:[function(t,e,n){var r=t("./_export"),o=t("./_task");r(r.G+r.B,{setImmediate:o.set,clearImmediate:o.clear})},{"./_export":27,"./_task":90}],191:[function(t,e,n){var r=t("./_global"),o=t("./_export"),i=r.navigator,a=[].slice,s=!!i&&/MSIE .\./.test(i.userAgent),u=function(t){return function(e,n){var r=arguments.length>2,o=!!r&&a.call(arguments,2);return t(r?function(){("function"==typeof e?e:Function(e)).apply(this,o)}:e,n)}};o(o.G+o.B+o.F*s,{setTimeout:u(r.setTimeout),setInterval:u(r.setInterval)})},{"./_export":27,"./_global":33}],192:[function(e,n,r){var o=o||function(t){"use strict";if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var e=t.document,n=function(){return t.URL||t.webkitURL||t},r=e.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,i=function(t){var e=new MouseEvent("click");t.dispatchEvent(e)},a=t.webkitRequestFileSystem,s=t.requestFileSystem||a||t.mozRequestFileSystem,u=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},c=0,l=function(e){var r=function(){"string"==typeof e?n().revokeObjectURL(e):e.remove()};t.chrome?r():setTimeout(r,500)},f=function(t,e,n){e=[].concat(e);for(var r=e.length;r--;){var o=t["on"+e[r]];if("function"==typeof o)try{o.call(t,n||t)}catch(t){u(t)}}},p=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t},d=function(e,u,d){d||(e=p(e));var h,m,g,v=this,b=e.type,y=!1,_=function(){f(v,"writestart progress write writeend".split(" "))},x=function(){if(!y&&h||(h=n().createObjectURL(e)),m)m.location.href=h;else{void 0==t.open(h,"_blank")&&"undefined"!=typeof safari&&(t.location.href=h)}v.readyState=v.DONE,_(),l(h)},w=function(t){return function(){if(v.readyState!==v.DONE)return t.apply(this,arguments)}},S={create:!0,exclusive:!1};return v.readyState=v.INIT,u||(u="download"),o?(h=n().createObjectURL(e),r.href=h,r.download=u,void setTimeout(function(){i(r),_(),l(h),v.readyState=v.DONE})):(t.chrome&&b&&"application/octet-stream"!==b&&(g=e.slice||e.webkitSlice,e=g.call(e,0,e.size,"application/octet-stream"),y=!0),a&&"download"!==u&&(u+=".download"),("application/octet-stream"===b||a)&&(m=t),s?(c+=e.size,void s(t.TEMPORARY,c,w(function(t){t.root.getDirectory("saved",S,w(function(t){var n=function(){t.getFile(u,S,w(function(t){t.createWriter(w(function(n){n.onwriteend=function(e){m.location.href=t.toURL(),v.readyState=v.DONE,f(v,"writeend",e),l(t)},n.onerror=function(){var t=n.error;t.code!==t.ABORT_ERR&&x()},"writestart progress write abort".split(" ").forEach(function(t){n["on"+t]=v["on"+t]}),n.write(e),v.abort=function(){n.abort(),v.readyState=v.DONE},v.readyState=v.WRITING}),x)}),x)};t.getFile(u,{create:!1},w(function(t){t.remove(),n()}),w(function(t){t.code===t.NOT_FOUND_ERR?n():x()}))}),x)}),x)):void x())},h=d.prototype,m=function(t,e,n){return new d(t,e,n)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,n){return n||(t=p(t)),navigator.msSaveOrOpenBlob(t,e||"download")}:(h.abort=function(){var t=this;t.readyState=t.DONE,f(t,"abort")},h.readyState=h.INIT=0,h.WRITING=1,h.DONE=2,h.error=h.onwritestart=h.onprogress=h.onwrite=h.onabort=h.onerror=h.onwriteend=null,m)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);void 0!==n&&n.exports?n.exports.saveAs=o:void 0!==t&&null!==t&&null!=t.amd&&t([],function(){return o})},{}],193:[function(t,e,n){var r={};e.exports=r,r.createElement=function(t){return document.createElement(t)},r.createText=function(t){return document.createTextNode(t)},r.style=function(t,e){t.style.cssText=e},r.append=function(t,e){t.appendChild(e)},r.remove=function(t,e){t.removeChild(e)}},{}],194:[function(t,e,n){var r=t("promise"),o=t("./dom"),i=t("./ruler"),a=function(t,e){e=e||{weight:"normal"},this.family=t,this.style=e.style||"normal",this.variant=e.variant||"normal",this.weight=e.weight||"normal",this.stretch=e.stretch||"stretch",this.featureSettings=e.featureSettings||"normal"};e.exports=a,a.HAS_WEBKIT_FALLBACK_BUG=null,a.DEFAULT_TIMEOUT=3e3,a.getUserAgent=function(){return window.navigator.userAgent},a.hasWebKitFallbackBug=function(){if(null===a.HAS_WEBKIT_FALLBACK_BUG){var t=/AppleWeb[kK]it\/([0-9]+)(?:\.([0-9]+))/.exec(a.getUserAgent());a.HAS_WEBKIT_FALLBACK_BUG=!!t&&(parseInt(t[1],10)<536||536===parseInt(t[1],10)&&parseInt(t[2],10)<=11)}return a.HAS_WEBKIT_FALLBACK_BUG},a.prototype.getStyle=function(){return"font-style:"+this.style+";font-variant:"+this.variant+";font-weight:"+this.weight+";font-stretch:"+this.stretch+";font-feature-settings:"+this.featureSettings+";-moz-font-feature-settings:"+this.featureSettings+";-webkit-font-feature-settings:"+this.featureSettings+";"},a.prototype.check=function(t,e){var n=t||"BESbswy",s=e||a.DEFAULT_TIMEOUT,u=this.getStyle(),c=o.createElement("div"),l=new i(n),f=new i(n),p=new i(n),d=-1,h=-1,m=-1,g=-1,v=-1,b=-1,y=this;return l.setFont('"Times New Roman", sans-serif',u),f.setFont("serif",u),p.setFont("monospace",u),o.append(c,l.getElement()),o.append(c,f.getElement()),o.append(c,p.getElement()),o.append(document.body,c),g=l.getWidth(),v=f.getWidth(),b=p.getWidth(),new r(function(t,e){function n(){null!==c.parentNode&&o.remove(document.body,c)}function r(){-1!==d&&-1!==h&&-1!==m&&d===h&&h===m&&(a.hasWebKitFallbackBug()?d===g&&h===g&&m===g||d===v&&h===v&&m===v||d===b&&h===b&&m===b||(n(),t(y)):(n(),t(y)))}setTimeout(function(){n(),e(y)},s),l.onResize(function(t){d=t,r()}),l.setFont(y.family+",sans-serif",u),f.onResize(function(t){h=t,r()}),f.setFont(y.family+",serif",u),p.onResize(function(t){m=t,r()}),p.setFont(y.family+",monospace",u)})}},{"./dom":193,"./ruler":195,promise:485}],195:[function(t,e,n){var r=t("./dom"),o=function(t){var e="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;";this.element=r.createElement("div"),this.element.setAttribute("aria-hidden","true"),r.append(this.element,r.createText(t)),this.collapsible=r.createElement("span"),this.expandable=r.createElement("span"),this.collapsibleInner=r.createElement("span"),this.expandableInner=r.createElement("span"),this.lastOffsetWidth=-1,r.style(this.collapsible,e),r.style(this.expandable,e),r.style(this.expandableInner,e),r.style(this.collapsibleInner,"display:inline-block;width:200%;height:200%;"),r.append(this.collapsible,this.collapsibleInner),r.append(this.expandable,this.expandableInner),r.append(this.element,this.collapsible),r.append(this.element,this.expandable)};e.exports=o,o.prototype.getElement=function(){return this.element},o.prototype.setFont=function(t,e){r.style(this.element,"min-width:20px;min-height:20px;display:inline-block;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font-size:100px;font-family:"+t+";"+e)},o.prototype.getWidth=function(){return this.element.offsetWidth},o.prototype.setWidth=function(t){this.element.style.width=t+"px"},o.prototype.reset=function(){var t=this.getWidth(),e=t+100;return this.expandableInner.style.width=e+"px",this.expandable.scrollLeft=e,this.collapsible.scrollLeft=this.collapsible.scrollWidth+100,this.lastOffsetWidth!==t&&(this.lastOffsetWidth=t,!0)},o.prototype.onScroll=function(t){this.reset()&&null!==this.element.parentNode&&t(this.lastOffsetWidth)},o.prototype.onResize=function(t){var e=this;this.collapsible.addEventListener("scroll",function(){e.onScroll(t)},!1),this.expandable.addEventListener("scroll",function(){e.onScroll(t)},!1),this.reset()}},{"./dom":193}],196:[function(t,e,n){"use strict";function r(t,e,n,r,o){var i=this.validateSchema(t,o,e,n);return!i.valid&&r instanceof Function&&r(i),i.valid}function o(t,e,n,r,o,i){if(!e.properties||void 0===e.properties[o])if(!1===e.additionalProperties)i.addError({name:"additionalProperties",argument:o,message:"additionalProperty "+JSON.stringify(o)+" exists in instance when not allowed"});else{var a=e.additionalProperties||{},s=this.validateSchema(t[o],a,n,r.makeChild(a,o));s.instance!==i.instance[o]&&(i.instance[o]=s.instance),i.importErrors(s)}}function i(t,e,n){var r,o=n.length;for(r=e+1,o;r<o;r++)if(a.deepCompareStrict(t,n[r]))return!1;return!0}var a=t("./helpers"),s=a.ValidatorResult,u=a.SchemaError,c={};c.ignoreProperties={id:!0,default:!0,description:!0,title:!0,exclusiveMinimum:!0,exclusiveMaximum:!0,additionalItems:!0,$schema:!0,$ref:!0,extends:!0};var l=c.validators={};l.type=function(t,e,n,r){if(void 0===t)return null;var o=new s(t,e,n,r),i=Array.isArray(e.type)?e.type:[e.type];if(!i.some(this.testType.bind(this,t,e,n,r))){var a=i.map(function(t){return t.id&&"<"+t.id+">"||t+""});o.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return o},l.anyOf=function(t,e,n,o){if(void 0===t)return null;var i=new s(t,e,n,o),a=new s(t,e,n,o);if(!Array.isArray(e.anyOf))throw new u("anyOf must be an array");if(!e.anyOf.some(r.bind(this,t,n,o,function(t){a.importErrors(t)}))){var c=e.anyOf.map(function(t,e){return t.id&&"<"+t.id+">"||t.title&&JSON.stringify(t.title)||t.$ref&&"<"+t.$ref+">"||"[subschema "+e+"]"});n.nestedErrors&&i.importErrors(a),i.addError({name:"anyOf",argument:c,message:"is not any of "+c.join(",")})}return i},l.allOf=function(t,e,n,r){if(void 0===t)return null;if(!Array.isArray(e.allOf))throw new u("allOf must be an array");var o=new s(t,e,n,r),i=this;return e.allOf.forEach(function(e,a){var s=i.validateSchema(t,e,n,r);if(!s.valid){var u=e.id&&"<"+e.id+">"||e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+a+"]";o.addError({name:"allOf",argument:{id:u,length:s.errors.length,valid:s},message:"does not match allOf schema "+u+" with "+s.errors.length+" error[s]:"}),o.importErrors(s)}}),o},l.oneOf=function(t,e,n,o){if(void 0===t)return null;if(!Array.isArray(e.oneOf))throw new u("oneOf must be an array");var i=new s(t,e,n,o),a=new s(t,e,n,o),c=e.oneOf.filter(r.bind(this,t,n,o,function(t){a.importErrors(t)})).length,l=e.oneOf.map(function(t,e){return t.id&&"<"+t.id+">"||t.title&&JSON.stringify(t.title)||t.$ref&&"<"+t.$ref+">"||"[subschema "+e+"]"});return 1!==c&&(n.nestedErrors&&i.importErrors(a),i.addError({name:"oneOf",argument:l,message:"is not exactly one from "+l.join(",")})),i},l.properties=function(t,e,n,r){if(void 0!==t&&t instanceof Object){var o=new s(t,e,n,r),i=e.properties||{};for(var a in i){var u=(t||void 0)&&t[a],c=this.validateSchema(u,i[a],n,r.makeChild(i[a],a));c.instance!==o.instance[a]&&(o.instance[a]=c.instance),o.importErrors(c)}return o}},l.patternProperties=function(t,e,n,r){if(void 0!==t&&this.types.object(t)){var i=new s(t,e,n,r),a=e.patternProperties||{};for(var u in t){var c=!0;for(var l in a){if(new RegExp(l).test(u)){c=!1;var f=this.validateSchema(t[u],a[l],n,r.makeChild(a[l],u));f.instance!==i.instance[u]&&(i.instance[u]=f.instance),i.importErrors(f)}}c&&o.call(this,t,e,n,r,u,i)}return i}},l.additionalProperties=function(t,e,n,r){if(void 0!==t&&this.types.object(t)){if(e.patternProperties)return null;var i=new s(t,e,n,r);for(var a in t)o.call(this,t,e,n,r,a,i);return i}},l.minProperties=function(t,e,n,r){if(!t||"object"!=typeof t)return null;var o=new s(t,e,n,r);return Object.keys(t).length>=e.minProperties||o.addError({name:"minProperties",argument:e.minProperties,message:"does not meet minimum property length of "+e.minProperties}),o},l.maxProperties=function(t,e,n,r){if(!t||"object"!=typeof t)return null;var o=new s(t,e,n,r);return Object.keys(t).length<=e.maxProperties||o.addError({name:"maxProperties",argument:e.maxProperties,message:"does not meet maximum property length of "+e.maxProperties}),o},l.items=function(t,e,n,r){if(!Array.isArray(t))return null;var o=this,i=new s(t,e,n,r);return void 0!==t&&e.items?(t.every(function(t,a){var s=Array.isArray(e.items)?e.items[a]||e.additionalItems:e.items;if(void 0===s)return!0;if(!1===s)return i.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=o.validateSchema(t,s,n,r.makeChild(s,a));return u.instance!==i.instance[a]&&(i.instance[a]=u.instance),i.importErrors(u),!0}),i):i},l.minimum=function(t,e,n,r){if("number"!=typeof t)return null;var o=new s(t,e,n,r),i=!0;return i=e.exclusiveMinimum&&!0===e.exclusiveMinimum?t>e.minimum:t>=e.minimum,i||o.addError({name:"minimum",argument:e.minimum,message:"must have a minimum value of "+e.minimum}),o},l.maximum=function(t,e,n,r){if("number"!=typeof t)return null;var o,i=new s(t,e,n,r);return o=e.exclusiveMaximum&&!0===e.exclusiveMaximum?t<e.maximum:t<=e.maximum,o||i.addError({name:"maximum",argument:e.maximum,message:"must have a maximum value of "+e.maximum}),i},l.divisibleBy=function(t,e,n,r){if("number"!=typeof t)return null;if(0==e.divisibleBy)throw new u("divisibleBy cannot be zero");var o=new s(t,e,n,r);return t/e.divisibleBy%1&&o.addError({name:"divisibleBy",argument:e.divisibleBy,message:"is not divisible by (multiple of) "+JSON.stringify(e.divisibleBy)}),o},l.multipleOf=function(t,e,n,r){if("number"!=typeof t)return null;if(0==e.multipleOf)throw new u("multipleOf cannot be zero");var o=new s(t,e,n,r);return t/e.multipleOf%1&&o.addError({name:"multipleOf",argument:e.multipleOf,message:"is not a multiple of (divisible by) "+JSON.stringify(e.multipleOf)}),o},l.required=function(t,e,n,r){var o=new s(t,e,n,r);return void 0===t&&!0===e.required?o.addError({name:"required",message:"is required"}):t&&"object"==typeof t&&Array.isArray(e.required)&&e.required.forEach(function(e){void 0===t[e]&&o.addError({name:"required",argument:e,message:"requires property "+JSON.stringify(e)})}),o},l.pattern=function(t,e,n,r){if("string"!=typeof t)return null;var o=new s(t,e,n,r);return t.match(e.pattern)||o.addError({name:"pattern",argument:e.pattern,message:"does not match pattern "+JSON.stringify(e.pattern)}),o},l.format=function(t,e,n,r){var o=new s(t,e,n,r);return o.disableFormat||a.isFormat(t,e.format,this)||o.addError({name:"format",argument:e.format,message:"does not conform to the "+JSON.stringify(e.format)+" format"}),o},l.minLength=function(t,e,n,r){if("string"!=typeof t)return null;var o=new s(t,e,n,r);return t.length>=e.minLength||o.addError({name:"minLength",argument:e.minLength,message:"does not meet minimum length of "+e.minLength}),o},l.maxLength=function(t,e,n,r){if("string"!=typeof t)return null;var o=new s(t,e,n,r);return t.length<=e.maxLength||o.addError({name:"maxLength",argument:e.maxLength,message:"does not meet maximum length of "+e.maxLength}),o},l.minItems=function(t,e,n,r){if(!Array.isArray(t))return null;var o=new s(t,e,n,r);return t.length>=e.minItems||o.addError({name:"minItems",argument:e.minItems,message:"does not meet minimum length of "+e.minItems}),o},l.maxItems=function(t,e,n,r){if(!Array.isArray(t))return null;var o=new s(t,e,n,r);return t.length<=e.maxItems||o.addError({name:"maxItems",argument:e.maxItems,message:"does not meet maximum length of "+e.maxItems}),o},l.uniqueItems=function(t,e,n,r){function o(t,e,n){for(var r=e+1;r<n.length;r++)if(a.deepCompareStrict(t,n[r]))return!1;return!0}var i=new s(t,e,n,r);return Array.isArray(t)?(t.every(o)||i.addError({name:"uniqueItems",message:"contains duplicate item"}),i):i},l.uniqueItems=function(t,e,n,r){if(!Array.isArray(t))return null;var o=new s(t,e,n,r);return t.every(i)||o.addError({name:"uniqueItems",message:"contains duplicate item"}),o},l.dependencies=function(t,e,n,r){if(!t||"object"!=typeof t)return null;var o=new s(t,e,n,r);for(var i in e.dependencies)if(void 0!==t[i]){var a=e.dependencies[i],u=r.makeChild(a,i);if("string"==typeof a&&(a=[a]),Array.isArray(a))a.forEach(function(e){void 0===t[e]&&o.addError({name:"dependencies",argument:u.propertyPath,message:"property "+e+" not found, required by "+u.propertyPath})});else{var c=this.validateSchema(t,a,n,u);o.instance!==c.instance&&(o.instance=c.instance),c&&c.errors.length&&(o.addError({name:"dependencies",argument:u.propertyPath,message:"does not meet dependency required by "+u.propertyPath}),o.importErrors(c))}}return o},l.enum=function(t,e,n,r){if(!Array.isArray(e.enum))throw new u("enum expects an array",e);if(void 0===t)return null;var o=new s(t,e,n,r);return e.enum.some(a.deepCompareStrict.bind(null,t))||o.addError({name:"enum",argument:e.enum,message:"is not one of enum values: "+e.enum.join(",")}),o},l.not=l.disallow=function(t,e,n,r){var o=this;if(void 0===t)return null;var i=new s(t,e,n,r),a=e.not||e.disallow;return a?(Array.isArray(a)||(a=[a]),a.forEach(function(a){if(o.testType(t,e,n,r,a)){var s=a&&a.id&&"<"+a.id+">"||a;i.addError({name:"not",argument:s,message:"is of prohibited type "+s})}}),i):null},e.exports=c},{"./helpers":197}],197:[function(t,e,n){"use strict";function r(t,e){return e+": "+t.toString()+"\n"}function o(t,e,n,r){"object"==typeof n?e[r]=s(t[r],n):-1===t.indexOf(n)&&e.push(n)}function i(t,e,n){e[n]=t[n]}function a(t,e,n,r){"object"==typeof e[r]&&e[r]&&t[r]?n[r]=s(t[r],e[r]):n[r]=e[r]}function s(t,e){var n=Array.isArray(e),r=n&&[]||{};return n?(t=t||[],r=r.concat(t),e.forEach(o.bind(null,t,r))):(t&&"object"==typeof t&&Object.keys(t).forEach(i.bind(null,t,r)),Object.keys(e).forEach(a.bind(null,t,e,r))),r}function u(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}var c=t("url"),l=n.ValidationError=function(t,e,n,r,o,i){r&&(this.property=r),t&&(this.message=t),n&&(n.id?this.schema=n.id:this.schema=n),e&&(this.instance=e),this.name=o,this.argument=i,this.stack=this.toString()};l.prototype.toString=function(){return this.property+" "+this.message};var f=n.ValidatorResult=function(t,e,n,r){this.instance=t,this.schema=e,this.propertyPath=r.propertyPath,this.errors=[],this.throwError=n&&n.throwError,this.disableFormat=n&&!0===n.disableFormat};f.prototype.addError=function(t){var e;if("string"==typeof t)e=new l(t,this.instance,this.schema,this.propertyPath);else{if(!t)throw new Error("Missing error detail");if(!t.message)throw new Error("Missing error message");if(!t.name)throw new Error("Missing validator type");e=new l(t.message,this.instance,this.schema,this.propertyPath,t.name,t.argument)}if(this.throwError)throw e;return this.errors.push(e),e},f.prototype.importErrors=function(t){"string"==typeof t||t&&t.validatorType?this.addError(t):t&&t.errors&&Array.prototype.push.apply(this.errors,t.errors)},f.prototype.toString=function(t){return this.errors.map(r).join("")},Object.defineProperty(f.prototype,"valid",{get:function(){return!this.errors.length}});var p=n.SchemaError=function t(e,n){this.message=e,this.schema=n,Error.call(this,e),Error.captureStackTrace(this,t)};p.prototype=Object.create(Error.prototype,{constructor:{value:p,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var d=n.SchemaContext=function(t,e,n,r,o){this.schema=t,this.options=e,this.propertyPath=n,this.base=r,this.schemas=o};d.prototype.resolve=function(t){return c.resolve(this.base,t)},d.prototype.makeChild=function(t,e){var n=void 0===e?this.propertyPath:this.propertyPath+m(e),r=c.resolve(this.base,t.id||""),o=new d(t,this.options,n,r,Object.create(this.schemas));return t.id&&!o.schemas[r]&&(o.schemas[r]=t),o};var h=n.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+-.]*:[^\s]*$/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/,"utc-millisec":function(t){return"string"==typeof t&&parseFloat(t)===parseInt(t,10)&&!isNaN(t)},regex:function(t){var e=!0;try{new RegExp(t)}catch(t){e=!1}return e},style:/\s*(.+?):\s*([^;]+);?/g,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/};h.regexp=h.regex,h.pattern=h.regex,h.ipv4=h["ip-address"],n.isFormat=function(t,e,n){if("string"==typeof t&&void 0!==h[e]){if(h[e]instanceof RegExp)return h[e].test(t);if("function"==typeof h[e])return h[e](t)}else if(n&&n.customFormats&&"function"==typeof n.customFormats[e])return n.customFormats[e](t);return!0};var m=n.makeSuffix=function(t){return t=t.toString(),t.match(/[.\s\[\]]/)||t.match(/^[\d]/)?t.match(/^\d+$/)?"["+t+"]":"["+JSON.stringify(t)+"]":"."+t};n.deepCompareStrict=function t(e,n){if(typeof e!=typeof n)return!1;if(e instanceof Array)return n instanceof Array&&(e.length===n.length&&e.every(function(r,o){return t(e[o],n[o])}));if("object"==typeof e){if(!e||!n)return e===n;var r=Object.keys(e),o=Object.keys(n);return r.length===o.length&&r.every(function(r){return t(e[r],n[r])})}return e===n},e.exports.deepMerge=s,n.objectGetPath=function(t,e){for(var n,r=e.split("/").slice(1);"string"==typeof(n=r.shift());){var o=decodeURIComponent(n.replace(/~0/,"~").replace(/~1/g,"/"));if(!(o in t))return;t=t[o]}return t},n.encodePath=function(t){return t.map(u).join("")}},{url:511}],198:[function(t,e,n){"use strict";var r=e.exports.Validator=t("./validator");e.exports.ValidatorResult=t("./helpers").ValidatorResult,e.exports.ValidationError=t("./helpers").ValidationError,e.exports.SchemaError=t("./helpers").SchemaError,e.exports.validate=function(t,e,n){return(new r).validate(t,e,n)}},{"./helpers":197,"./validator":199}],199:[function(t,e,n){"use strict";function r(t){var e="string"==typeof t?t:t.$ref;return"string"==typeof e&&e}var o=t("url"),i=t("./attribute"),a=t("./helpers"),s=a.ValidatorResult,u=a.SchemaError,c=a.SchemaContext,l=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(f),this.attributes=Object.create(i.validators)};l.prototype.customFormats={},l.prototype.schemas=null,l.prototype.types=null,l.prototype.attributes=null,l.prototype.unresolvedRefs=null,l.prototype.addSchema=function(t,e){if(!t)return null;var n=e||t.id;return this.addSubSchema(n,t),n&&(this.schemas[n]=t),this.schemas[n]},l.prototype.addSubSchema=function(t,e){if(e&&"object"==typeof e){if(e.$ref){var n=o.resolve(t,e.$ref);return void(void 0===this.schemas[n]&&(this.schemas[n]=null,this.unresolvedRefs.push(n)))}var r=e.id&&o.resolve(t,e.id),i=r||t;if(r){if(this.schemas[r]){if(!a.deepCompareStrict(this.schemas[r],e))throw new Error("Schema <"+e+"> already exists with different definition");return this.schemas[r]}this.schemas[r]=e;var s=r.replace(/^([^#]*)#$/,"$1");this.schemas[s]=e}return this.addSubSchemaArray(i,e.items instanceof Array?e.items:[e.items]),this.addSubSchemaArray(i,e.extends instanceof Array?e.extends:[e.extends]),this.addSubSchema(i,e.additionalItems),this.addSubSchemaObject(i,e.properties),this.addSubSchema(i,e.additionalProperties),this.addSubSchemaObject(i,e.definitions),this.addSubSchemaObject(i,e.patternProperties),this.addSubSchemaObject(i,e.dependencies),this.addSubSchemaArray(i,e.disallow),this.addSubSchemaArray(i,e.allOf),this.addSubSchemaArray(i,e.anyOf),this.addSubSchemaArray(i,e.oneOf),this.addSubSchema(i,e.not),this.schemas[r]}},l.prototype.addSubSchemaArray=function(t,e){if(e instanceof Array)for(var n=0;n<e.length;n++)this.addSubSchema(t,e[n])},l.prototype.addSubSchemaObject=function(t,e){if(e&&"object"==typeof e)for(var n in e)this.addSubSchema(t,e[n])},l.prototype.setSchemas=function(t){this.schemas=t},l.prototype.getSchema=function(t){return this.schemas[t]},l.prototype.validate=function(t,e,n,r){n||(n={});var i=n.propertyName||"instance",a=o.resolve(n.base||"/",e.id||"");if(r||(r=new c(e,n,i,a,Object.create(this.schemas)),r.schemas[a]||(r.schemas[a]=e)),e){var s=this.validateSchema(t,e,n,r);if(!s)throw new Error("Result undefined");return s}throw new u("no schema specified",e)},l.prototype.validateSchema=function(t,e,n,o){var l=new s(t,e,n,o);if(!e)throw new Error("schema is undefined");if(e.extends)if(e.extends instanceof Array){var f={schema:e,ctx:o};e.extends.forEach(this.schemaTraverser.bind(this,f)),e=f.schema,f.schema=null,f.ctx=null,f=null}else e=a.deepMerge(e,this.superResolve(e.extends,o));var p;if(p=r(e)){var d=this.resolve(e,p,o),h=new c(d.subschema,n,o.propertyPath,d.switchSchema,o.schemas);return this.validateSchema(t,d.subschema,n,h)}var m=n&&n.skipAttributes||[];for(var g in e)if(!i.ignoreProperties[g]&&m.indexOf(g)<0){var v=null,b=this.attributes[g];if(b)v=b.call(this,t,e,n,o);else if(!1===n.allowUnknownAttributes)throw new u("Unsupported attribute: "+g,e);v&&l.importErrors(v)}if("function"==typeof n.rewrite){var y=n.rewrite.call(this,t,e,n,o);l.instance=y}return l},l.prototype.schemaTraverser=function(t,e){t.schema=a.deepMerge(t.schema,this.superResolve(e,t.ctx))},l.prototype.superResolve=function(t,e){var n;return(n=r(t))?this.resolve(t,n,e).subschema:t},l.prototype.resolve=function(t,e,n){if(e=n.resolve(e),n.schemas[e])return{subschema:n.schemas[e],switchSchema:e};var r=o.parse(e),i=r&&r.hash,s=i&&i.length&&e.substr(0,e.length-i.length);if(!s||!n.schemas[s])throw new u("no such schema <"+e+">",t);var c=a.objectGetPath(n.schemas[s],i.substr(1));if(void 0===c)throw new u("no such schema "+i+" located in <"+s+">",t);return{subschema:c,switchSchema:e}},l.prototype.testType=function(t,e,n,r,o){if("function"==typeof this.types[o])return this.types[o].call(this,t);if(o&&"object"==typeof o){var i=this.validateSchema(t,o,n,r);return void 0===i||!(i&&i.errors.length)}return!0};var f=l.prototype.types={};f.string=function(t){return"string"==typeof t},f.number=function(t){return"number"==typeof t&&isFinite(t)},f.integer=function(t){return"number"==typeof t&&t%1==0},f.boolean=function(t){return"boolean"==typeof t},f.array=function(t){return t instanceof Array},f.null=function(t){return null===t},f.date=function(t){return t instanceof Date},f.any=function(t){return!0},f.object=function(t){return t&&"object"==typeof t&&!(t instanceof Array)&&!(t instanceof Date)},e.exports=l},{"./attribute":196,"./helpers":197,url:511}],200:[function(t,e,n){var r=t("./_getNative"),o=t("./_root"),i=r(o,"DataView");e.exports=i},{"./_getNative":323,"./_root":378}],201:[function(t,e,n){function r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}var o=t("./_hashClear"),i=t("./_hashDelete"),a=t("./_hashGet"),s=t("./_hashHas"),u=t("./_hashSet");r.prototype.clear=o,r.prototype.delete=i,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,e.exports=r},{"./_hashClear":334,"./_hashDelete":335,"./_hashGet":336,"./_hashHas":337,"./_hashSet":338}],202:[function(t,e,n){function r(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=a,this.__views__=[]}var o=t("./_baseCreate"),i=t("./_baseLodash"),a=4294967295;r.prototype=o(i.prototype),r.prototype.constructor=r,e.exports=r},{"./_baseCreate":234,"./_baseLodash":256}],203:[function(t,e,n){function r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}var o=t("./_listCacheClear"),i=t("./_listCacheDelete"),a=t("./_listCacheGet"),s=t("./_listCacheHas"),u=t("./_listCacheSet");r.prototype.clear=o,r.prototype.delete=i,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,e.exports=r},{"./_listCacheClear":352,"./_listCacheDelete":353,"./_listCacheGet":354,"./_listCacheHas":355,"./_listCacheSet":356}],204:[function(t,e,n){function r(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}var o=t("./_baseCreate"),i=t("./_baseLodash");r.prototype=o(i.prototype),r.prototype.constructor=r,e.exports=r},{"./_baseCreate":234,"./_baseLodash":256}],205:[function(t,e,n){var r=t("./_getNative"),o=t("./_root"),i=r(o,"Map");e.exports=i},{"./_getNative":323,"./_root":378}],206:[function(t,e,n){function r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}var o=t("./_mapCacheClear"),i=t("./_mapCacheDelete"),a=t("./_mapCacheGet"),s=t("./_mapCacheHas"),u=t("./_mapCacheSet");r.prototype.clear=o,r.prototype.delete=i,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,e.exports=r},{"./_mapCacheClear":357,"./_mapCacheDelete":358,"./_mapCacheGet":359,"./_mapCacheHas":360,"./_mapCacheSet":361}],207:[function(t,e,n){var r=t("./_getNative"),o=t("./_root"),i=r(o,"Promise");e.exports=i},{"./_getNative":323,"./_root":378}],208:[function(t,e,n){var r=t("./_getNative"),o=t("./_root"),i=r(o,"Set");e.exports=i},{"./_getNative":323,"./_root":378}],209:[function(t,e,n){function r(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new o;++e<n;)this.add(t[e])}var o=t("./_MapCache"),i=t("./_setCacheAdd"),a=t("./_setCacheHas");r.prototype.add=r.prototype.push=i,r.prototype.has=a,e.exports=r},{"./_MapCache":206,"./_setCacheAdd":379,"./_setCacheHas":380}],210:[function(t,e,n){function r(t){var e=this.__data__=new o(t);this.size=e.size}var o=t("./_ListCache"),i=t("./_stackClear"),a=t("./_stackDelete"),s=t("./_stackGet"),u=t("./_stackHas"),c=t("./_stackSet");r.prototype.clear=i,r.prototype.delete=a,r.prototype.get=s,r.prototype.has=u,r.prototype.set=c,e.exports=r},{"./_ListCache":203,"./_stackClear":386,"./_stackDelete":387,"./_stackGet":388,"./_stackHas":389,"./_stackSet":390}],211:[function(t,e,n){var r=t("./_root"),o=r.Symbol;e.exports=o},{"./_root":378}],212:[function(t,e,n){var r=t("./_root"),o=r.Uint8Array;e.exports=o},{"./_root":378}],213:[function(t,e,n){var r=t("./_getNative"),o=t("./_root"),i=r(o,"WeakMap");e.exports=i},{"./_getNative":323,"./_root":378}],214:[function(t,e,n){function r(t,e){return t.set(e[0],e[1]),t}e.exports=r},{}],215:[function(t,e,n){function r(t,e){return t.add(e),t}e.exports=r},{}],216:[function(t,e,n){function r(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}e.exports=r},{}],217:[function(t,e,n){function r(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}e.exports=r},{}],218:[function(t,e,n){function r(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i}e.exports=r},{}],219:[function(t,e,n){function r(t,e){return!!(null==t?0:t.length)&&o(t,e,0)>-1}var o=t("./_baseIndexOf");e.exports=r},{"./_baseIndexOf":245}],220:[function(t,e,n){function r(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1}e.exports=r},{}],221:[function(t,e,n){function r(t,e){var n=a(t),r=!n&&i(t),l=!n&&!r&&s(t),p=!n&&!r&&!l&&c(t),d=n||r||l||p,h=d?o(t.length,String):[],m=h.length;for(var g in t)!e&&!f.call(t,g)||d&&("length"==g||l&&("offset"==g||"parent"==g)||p&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||u(g,m))||h.push(g);return h}var o=t("./_baseTimes"),i=t("./isArguments"),a=t("./isArray"),s=t("./isBuffer"),u=t("./_isIndex"),c=t("./isTypedArray"),l=Object.prototype,f=l.hasOwnProperty;e.exports=r},{"./_baseTimes":270,"./_isIndex":344,"./isArguments":443,"./isArray":444,"./isBuffer":446,"./isTypedArray":455}],222:[function(t,e,n){function r(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}e.exports=r},{}],223:[function(t,e,n){function r(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}e.exports=r},{}],224:[function(t,e,n){function r(t,e,n,r){var o=-1,i=null==t?0:t.length;for(r&&i&&(n=t[++o]);++o<i;)n=e(n,t[o],o,t);return n}e.exports=r},{}],225:[function(t,e,n){function r(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}e.exports=r},{}],226:[function(t,e,n){function r(t){return t.split("")}e.exports=r},{}],227:[function(t,e,n){function r(t){return t.match(o)||[]}var o=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=r},{}],228:[function(t,e,n){function r(t,e,n){var r=t[e];s.call(t,e)&&i(r,n)&&(void 0!==n||e in t)||o(t,e,n)}var o=t("./_baseAssignValue"),i=t("./eq"),a=Object.prototype,s=a.hasOwnProperty;e.exports=r},{"./_baseAssignValue":232,"./eq":409}],229:[function(t,e,n){function r(t,e){for(var n=t.length;n--;)if(o(t[n][0],e))return n;return-1}var o=t("./eq");e.exports=r},{"./eq":409}],230:[function(t,e,n){function r(t,e){return t&&o(e,i(e),t)}var o=t("./_copyObject"),i=t("./keys");e.exports=r},{"./_copyObject":289,"./keys":457}],231:[function(t,e,n){function r(t,e){return t&&o(e,i(e),t)}var o=t("./_copyObject"),i=t("./keysIn");e.exports=r},{"./_copyObject":289,"./keysIn":458}],232:[function(t,e,n){function r(t,e,n){"__proto__"==e&&o?o(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var o=t("./_defineProperty");e.exports=r},{"./_defineProperty":310}],233:[function(t,e,n){function r(t,e,n,R,N,k){var I,B=e&S,M=e&O,L=e&A;if(n&&(I=N?n(t,R,N,k):n(t)),void 0!==I)return I;if(!x(t))return t;var D=y(t);if(D){if(I=g(t),!B)return l(t,I)}else{var F=m(t),G=F==j||F==P;if(_(t))return c(t,B);if(F==T||F==E||G&&!N){if(I=M||G?{}:b(t),!B)return M?p(t,u(I,t)):f(t,s(I,t))}else{if(!C[F])return N?t:{};I=v(t,F,r,B)}}k||(k=new o);var z=k.get(t);if(z)return z;k.set(t,I);var U=L?M?h:d:M?keysIn:w,W=D?void 0:U(t);return i(W||t,function(o,i){W&&(i=o,o=t[i]),a(I,i,r(o,e,n,i,t,k))}),I}var o=t("./_Stack"),i=t("./_arrayEach"),a=t("./_assignValue"),s=t("./_baseAssign"),u=t("./_baseAssignIn"),c=t("./_cloneBuffer"),l=t("./_copyArray"),f=t("./_copySymbols"),p=t("./_copySymbolsIn"),d=t("./_getAllKeys"),h=t("./_getAllKeysIn"),m=t("./_getTag"),g=t("./_initCloneArray"),v=t("./_initCloneByTag"),b=t("./_initCloneObject"),y=t("./isArray"),_=t("./isBuffer"),x=t("./isObject"),w=t("./keys"),S=1,O=2,A=4,E="[object Arguments]",j="[object Function]",P="[object GeneratorFunction]",T="[object Object]",C={};C[E]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object DataView]"]=C["[object Boolean]"]=C["[object Date]"]=C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Map]"]=C["[object Number]"]=C[T]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object Symbol]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Error]"]=C[j]=C["[object WeakMap]"]=!1,e.exports=r},{"./_Stack":210,"./_arrayEach":217,"./_assignValue":228,"./_baseAssign":230,"./_baseAssignIn":231,"./_cloneBuffer":279,"./_copyArray":288,"./_copySymbols":290,"./_copySymbolsIn":291,"./_getAllKeys":316,"./_getAllKeysIn":317,"./_getTag":328,"./_initCloneArray":339,"./_initCloneByTag":340,"./_initCloneObject":341,"./isArray":444,"./isBuffer":446,"./isObject":451,"./keys":457}],234:[function(t,e,n){var r=t("./isObject"),o=Object.create,i=function(){function t(){}return function(e){if(!r(e))return{};if(o)return o(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();e.exports=i},{"./isObject":451}],235:[function(t,e,n){var r=t("./_baseForOwn"),o=t("./_createBaseEach"),i=o(r);e.exports=i},{"./_baseForOwn":240,"./_createBaseEach":294}],236:[function(t,e,n){function r(t,e){var n=[];return o(t,function(t,r,o){e(t,r,o)&&n.push(t)}),n}var o=t("./_baseEach");e.exports=r},{"./_baseEach":235}],237:[function(t,e,n){function r(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}e.exports=r},{}],238:[function(t,e,n){function r(t,e,n,a,s){var u=-1,c=t.length;for(n||(n=i),s||(s=[]);++u<c;){var l=t[u];e>0&&n(l)?e>1?r(l,e-1,n,a,s):o(s,l):a||(s[s.length]=l)}return s}var o=t("./_arrayPush"),i=t("./_isFlattenable");e.exports=r},{"./_arrayPush":223,"./_isFlattenable":343}],239:[function(t,e,n){var r=t("./_createBaseFor"),o=r();e.exports=o},{"./_createBaseFor":295}],240:[function(t,e,n){function r(t,e){return t&&o(t,e,i)}var o=t("./_baseFor"),i=t("./keys");e.exports=r},{"./_baseFor":239,"./keys":457}],241:[function(t,e,n){function r(t,e){e=o(e,t);for(var n=0,r=e.length;null!=t&&n<r;)t=t[i(e[n++])];return n&&n==r?t:void 0}var o=t("./_castPath"),i=t("./_toKey");e.exports=r},{"./_castPath":276,"./_toKey":394}],242:[function(t,e,n){function r(t,e,n){var r=e(t);return i(t)?r:o(r,n(t))}var o=t("./_arrayPush"),i=t("./isArray");e.exports=r},{"./_arrayPush":223,"./isArray":444}],243:[function(t,e,n){function r(t){return null==t?void 0===t?u:s:c&&c in Object(t)?i(t):a(t)}var o=t("./_Symbol"),i=t("./_getRawTag"),a=t("./_objectToString"),s="[object Null]",u="[object Undefined]",c=o?o.toStringTag:void 0;e.exports=r},{"./_Symbol":211,"./_getRawTag":325,"./_objectToString":371}],244:[function(t,e,n){function r(t,e){return null!=t&&e in Object(t)}e.exports=r},{}],245:[function(t,e,n){function r(t,e,n){return e===e?a(t,e,n):o(t,i,n)}var o=t("./_baseFindIndex"),i=t("./_baseIsNaN"),a=t("./_strictIndexOf");e.exports=r},{"./_baseFindIndex":237,"./_baseIsNaN":250,"./_strictIndexOf":391}],246:[function(t,e,n){function r(t){return i(t)&&o(t)==a}var o=t("./_baseGetTag"),i=t("./isObjectLike"),a="[object Arguments]";e.exports=r},{"./_baseGetTag":243,"./isObjectLike":452}],247:[function(t,e,n){function r(t,e,n,a,s){return t===e||(null==t||null==e||!i(t)&&!i(e)?t!==t&&e!==e:o(t,e,n,a,r,s))}var o=t("./_baseIsEqualDeep"),i=t("./isObjectLike");e.exports=r},{"./_baseIsEqualDeep":248,"./isObjectLike":452}],248:[function(t,e,n){function r(t,e,n,r,g,b){var y=c(t),_=c(e),x=y?h:u(t),w=_?h:u(e);x=x==d?m:x,w=w==d?m:w;var S=x==m,O=w==m,A=x==w;if(A&&l(t)){if(!l(e))return!1;y=!0,S=!1}if(A&&!S)return b||(b=new o),y||f(t)?i(t,e,n,r,g,b):a(t,e,x,n,r,g,b);if(!(n&p)){var E=S&&v.call(t,"__wrapped__"),j=O&&v.call(e,"__wrapped__");if(E||j){var P=E?t.value():t,T=j?e.value():e;return b||(b=new o),g(P,T,n,r,b)}}return!!A&&(b||(b=new o),s(t,e,n,r,g,b))}var o=t("./_Stack"),i=t("./_equalArrays"),a=t("./_equalByTag"),s=t("./_equalObjects"),u=t("./_getTag"),c=t("./isArray"),l=t("./isBuffer"),f=t("./isTypedArray"),p=1,d="[object Arguments]",h="[object Array]",m="[object Object]",g=Object.prototype,v=g.hasOwnProperty;e.exports=r},{"./_Stack":210,"./_equalArrays":311,"./_equalByTag":312,"./_equalObjects":313,"./_getTag":328,"./isArray":444,"./isBuffer":446,"./isTypedArray":455}],249:[function(t,e,n){function r(t,e,n,r){var u=n.length,c=u,l=!r;if(null==t)return!c;for(t=Object(t);u--;){var f=n[u];if(l&&f[2]?f[1]!==t[f[0]]:!(f[0]in t))return!1}for(;++u<c;){f=n[u];var p=f[0],d=t[p],h=f[1];if(l&&f[2]){if(void 0===d&&!(p in t))return!1}else{var m=new o;if(r)var g=r(d,h,p,t,e,m);if(!(void 0===g?i(h,d,a|s,r,m):g))return!1}}return!0}var o=t("./_Stack"),i=t("./_baseIsEqual"),a=1,s=2;e.exports=r},{"./_Stack":210,"./_baseIsEqual":247}],250:[function(t,e,n){function r(t){return t!==t}e.exports=r},{}],251:[function(t,e,n){function r(t){return!(!a(t)||i(t))&&(o(t)?h:c).test(s(t))}var o=t("./isFunction"),i=t("./_isMasked"),a=t("./isObject"),s=t("./_toSource"),u=/[\\^$.*+?()[\]{}|]/g,c=/^\[object .+?Constructor\]$/,l=Function.prototype,f=Object.prototype,p=l.toString,d=f.hasOwnProperty,h=RegExp("^"+p.call(d).replace(u,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},{"./_isMasked":349,"./_toSource":395,"./isFunction":449,"./isObject":451}],252:[function(t,e,n){function r(t){return a(t)&&i(t.length)&&!!s[o(t)]}var o=t("./_baseGetTag"),i=t("./isLength"),a=t("./isObjectLike"),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,e.exports=r},{"./_baseGetTag":243,"./isLength":450,"./isObjectLike":452}],253:[function(t,e,n){function r(t){return"function"==typeof t?t:null==t?a:"object"==typeof t?s(t)?i(t[0],t[1]):o(t):u(t)}var o=t("./_baseMatches"),i=t("./_baseMatchesProperty"),a=t("./identity"),s=t("./isArray"),u=t("./property");e.exports=r},{"./_baseMatches":257,"./_baseMatchesProperty":258,"./identity":442,"./isArray":444,"./property":467}],254:[function(t,e,n){function r(t){if(!o(t))return i(t);var e=[];for(var n in Object(t))s.call(t,n)&&"constructor"!=n&&e.push(n);return e}var o=t("./_isPrototype"),i=t("./_nativeKeys"),a=Object.prototype,s=a.hasOwnProperty;e.exports=r},{"./_isPrototype":350,"./_nativeKeys":368}],255:[function(t,e,n){function r(t){if(!o(t))return a(t);var e=i(t),n=[];for(var r in t)("constructor"!=r||!e&&u.call(t,r))&&n.push(r);return n}var o=t("./isObject"),i=t("./_isPrototype"),a=t("./_nativeKeysIn"),s=Object.prototype,u=s.hasOwnProperty;e.exports=r},{"./_isPrototype":350,"./_nativeKeysIn":369,"./isObject":451}],256:[function(t,e,n){function r(){}e.exports=r},{}],257:[function(t,e,n){function r(t){var e=i(t);return 1==e.length&&e[0][2]?a(e[0][0],e[0][1]):function(n){return n===t||o(n,t,e)}}var o=t("./_baseIsMatch"),i=t("./_getMatchData"),a=t("./_matchesStrictComparable");e.exports=r},{"./_baseIsMatch":249,"./_getMatchData":322,"./_matchesStrictComparable":363}],258:[function(t,e,n){function r(t,e){return s(t)&&u(e)?c(l(t),e):function(n){var r=i(n,t);return void 0===r&&r===e?a(n,t):o(e,r,f|p)}}var o=t("./_baseIsEqual"),i=t("./get"),a=t("./hasIn"),s=t("./_isKey"),u=t("./_isStrictComparable"),c=t("./_matchesStrictComparable"),l=t("./_toKey"),f=1,p=2;e.exports=r},{"./_baseIsEqual":247,"./_isKey":346,"./_isStrictComparable":351,"./_matchesStrictComparable":363,"./_toKey":394,"./get":440,"./hasIn":441}],259:[function(t,e,n){function r(t,e){return o(t,e,function(e,n){return i(t,n)})}var o=t("./_basePickBy"),i=t("./hasIn");e.exports=r},{"./_basePickBy":260,"./hasIn":441}],260:[function(t,e,n){function r(t,e,n){for(var r=-1,s=e.length,u={};++r<s;){var c=e[r],l=o(t,c);n(l,c)&&i(u,a(c,t),l)}return u}var o=t("./_baseGet"),i=t("./_baseSet"),a=t("./_castPath");e.exports=r},{"./_baseGet":241,"./_baseSet":266,"./_castPath":276}],261:[function(t,e,n){function r(t){return function(e){return null==e?void 0:e[t]}}e.exports=r},{}],262:[function(t,e,n){function r(t){return function(e){return o(e,t)}}var o=t("./_baseGet");e.exports=r},{"./_baseGet":241}],263:[function(t,e,n){function r(t){return function(e){return null==t?void 0:t[e]}}e.exports=r},{}],264:[function(t,e,n){function r(t,e,n,r){for(var a=-1,s=i(o((e-t)/(n||1)),0),u=Array(s);s--;)u[r?s:++a]=t,t+=n;return u}var o=Math.ceil,i=Math.max;e.exports=r},{}],265:[function(t,e,n){function r(t,e,n,r,o){return o(t,function(t,o,i){n=r?(r=!1,t):e(n,t,o,i)}),n}e.exports=r},{}],266:[function(t,e,n){function r(t,e,n,r){if(!s(t))return t;e=i(e,t);for(var c=-1,l=e.length,f=l-1,p=t;null!=p&&++c<l;){var d=u(e[c]),h=n;if(c!=f){var m=p[d];h=r?r(m,d,p):void 0,void 0===h&&(h=s(m)?m:a(e[c+1])?[]:{})}o(p,d,h),p=p[d]}return t}var o=t("./_assignValue"),i=t("./_castPath"),a=t("./_isIndex"),s=t("./isObject"),u=t("./_toKey");e.exports=r},{"./_assignValue":228,"./_castPath":276,"./_isIndex":344,"./_toKey":394,"./isObject":451}],267:[function(t,e,n){var r=t("./identity"),o=t("./_metaMap"),i=o?function(t,e){return o.set(t,e),t}:r;e.exports=i},{"./_metaMap":366,"./identity":442}],268:[function(t,e,n){var r=t("./constant"),o=t("./_defineProperty"),i=t("./identity"),a=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:i;e.exports=a},{"./_defineProperty":310,"./constant":405,"./identity":442}],269:[function(t,e,n){function r(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),n=n>o?o:n,n<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=Array(o);++r<o;)i[r]=t[r+e];return i}e.exports=r},{}],270:[function(t,e,n){function r(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}e.exports=r},{}],271:[function(t,e,n){function r(t){if("string"==typeof t)return t;if(a(t))return i(t,r)+"";if(s(t))return l?l.call(t):"";var e=t+"";return"0"==e&&1/t==-u?"-0":e}var o=t("./_Symbol"),i=t("./_arrayMap"),a=t("./isArray"),s=t("./isSymbol"),u=1/0,c=o?o.prototype:void 0,l=c?c.toString:void 0;e.exports=r},{"./_Symbol":211,"./_arrayMap":222,"./isArray":444,"./isSymbol":454}],272:[function(t,e,n){function r(t){return function(e){return t(e)}}e.exports=r},{}],273:[function(t,e,n){function r(t,e,n){var r=-1,f=i,p=t.length,d=!0,h=[],m=h;if(n)d=!1,f=a;else if(p>=l){var g=e?null:u(t);if(g)return c(g);d=!1,f=s,m=new o}else m=e?[]:h;t:for(;++r<p;){var v=t[r],b=e?e(v):v;if(v=n||0!==v?v:0,d&&b===b){for(var y=m.length;y--;)if(m[y]===b)continue t;e&&m.push(b),h.push(v)}else f(m,b,n)||(m!==h&&m.push(b),h.push(v))}return h}var o=t("./_SetCache"),i=t("./_arrayIncludes"),a=t("./_arrayIncludesWith"),s=t("./_cacheHas"),u=t("./_createSet"),c=t("./_setToArray"),l=200;e.exports=r},{"./_SetCache":209,"./_arrayIncludes":219,"./_arrayIncludesWith":220,"./_cacheHas":275,"./_createSet":306,"./_setToArray":382}],274:[function(t,e,n){function r(t,e){return e=o(e,t),null==(t=a(t,e))||delete t[s(i(e))]}var o=t("./_castPath"),i=t("./last"),a=t("./_parent"),s=t("./_toKey");e.exports=r},{"./_castPath":276,"./_parent":374,"./_toKey":394,"./last":459}],275:[function(t,e,n){function r(t,e){return t.has(e)}e.exports=r},{}],276:[function(t,e,n){function r(t,e){return o(t)?t:i(t,e)?[t]:a(s(t))}var o=t("./isArray"),i=t("./_isKey"),a=t("./_stringToPath"),s=t("./toString");e.exports=r},{"./_isKey":346,"./_stringToPath":393,"./isArray":444,"./toString":477}],277:[function(t,e,n){function r(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:o(t,e,n)}var o=t("./_baseSlice");e.exports=r},{"./_baseSlice":269}],278:[function(t,e,n){function r(t){var e=new t.constructor(t.byteLength);return new o(e).set(new o(t)),e}var o=t("./_Uint8Array");e.exports=r},{"./_Uint8Array":212}],279:[function(t,e,n){function r(t,e){if(e)return t.slice();var n=t.length,r=c?c(n):new t.constructor(n);return t.copy(r),r}var o=t("./_root"),i="object"==typeof n&&n&&!n.nodeType&&n,a=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===i,u=s?o.Buffer:void 0,c=u?u.allocUnsafe:void 0;e.exports=r},{"./_root":378}],280:[function(t,e,n){function r(t,e){var n=e?o(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var o=t("./_cloneArrayBuffer");e.exports=r},{"./_cloneArrayBuffer":278}],281:[function(t,e,n){function r(t,e,n){var r=e?n(a(t),s):a(t);return i(r,o,new t.constructor)}var o=t("./_addMapEntry"),i=t("./_arrayReduce"),a=t("./_mapToArray"),s=1;e.exports=r},{"./_addMapEntry":214,"./_arrayReduce":224,"./_mapToArray":362}],282:[function(t,e,n){function r(t){var e=new t.constructor(t.source,o.exec(t));return e.lastIndex=t.lastIndex,e}var o=/\w*$/;e.exports=r},{}],283:[function(t,e,n){function r(t,e,n){var r=e?n(a(t),s):a(t);return i(r,o,new t.constructor)}var o=t("./_addSetEntry"),i=t("./_arrayReduce"),a=t("./_setToArray"),s=1;e.exports=r},{"./_addSetEntry":215,"./_arrayReduce":224,"./_setToArray":382}],284:[function(t,e,n){function r(t){return a?Object(a.call(t)):{}}var o=t("./_Symbol"),i=o?o.prototype:void 0,a=i?i.valueOf:void 0;e.exports=r},{"./_Symbol":211}],285:[function(t,e,n){function r(t,e){var n=e?o(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var o=t("./_cloneArrayBuffer");e.exports=r},{"./_cloneArrayBuffer":278}],286:[function(t,e,n){function r(t,e,n,r){for(var i=-1,a=t.length,s=n.length,u=-1,c=e.length,l=o(a-s,0),f=Array(c+l),p=!r;++u<c;)f[u]=e[u];for(;++i<s;)(p||i<a)&&(f[n[i]]=t[i]);for(;l--;)f[u++]=t[i++];return f}var o=Math.max;e.exports=r},{}],287:[function(t,e,n){function r(t,e,n,r){for(var i=-1,a=t.length,s=-1,u=n.length,c=-1,l=e.length,f=o(a-u,0),p=Array(f+l),d=!r;++i<f;)p[i]=t[i];for(var h=i;++c<l;)p[h+c]=e[c];for(;++s<u;)(d||i<a)&&(p[h+n[s]]=t[i++]);return p}var o=Math.max;e.exports=r},{}],288:[function(t,e,n){function r(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}e.exports=r},{}],289:[function(t,e,n){function r(t,e,n,r){var a=!n;n||(n={});for(var s=-1,u=e.length;++s<u;){var c=e[s],l=r?r(n[c],t[c],c,n,t):void 0;void 0===l&&(l=t[c]),a?i(n,c,l):o(n,c,l)}return n}var o=t("./_assignValue"),i=t("./_baseAssignValue");e.exports=r},{"./_assignValue":228,"./_baseAssignValue":232}],290:[function(t,e,n){function r(t,e){return o(t,i(t),e)}var o=t("./_copyObject"),i=t("./_getSymbols");e.exports=r},{"./_copyObject":289,"./_getSymbols":326}],291:[function(t,e,n){function r(t,e){return o(t,i(t),e)}var o=t("./_copyObject"),i=t("./_getSymbolsIn");e.exports=r},{"./_copyObject":289,"./_getSymbolsIn":327}],292:[function(t,e,n){var r=t("./_root"),o=r["__core-js_shared__"];e.exports=o},{"./_root":378}],293:[function(t,e,n){function r(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}e.exports=r},{}],294:[function(t,e,n){function r(t,e){return function(n,r){if(null==n)return n;if(!o(n))return t(n,r);for(var i=n.length,a=e?i:-1,s=Object(n);(e?a--:++a<i)&&!1!==r(s[a],a,s););return n}}var o=t("./isArrayLike");e.exports=r},{"./isArrayLike":445}],295:[function(t,e,n){function r(t){return function(e,n,r){for(var o=-1,i=Object(e),a=r(e),s=a.length;s--;){var u=a[t?s:++o];if(!1===n(i[u],u,i))break}return e}}e.exports=r},{}],296:[function(t,e,n){function r(t,e,n){function r(){return(this&&this!==i&&this instanceof r?u:t).apply(s?n:this,arguments)}var s=e&a,u=o(t);return r}var o=t("./_createCtor"),i=t("./_root"),a=1;e.exports=r},{"./_createCtor":299,"./_root":378}],297:[function(t,e,n){function r(t){return function(e){e=s(e);var n=i(e)?a(e):void 0,r=n?n[0]:e.charAt(0),u=n?o(n,1).join(""):e.slice(1);return r[t]()+u}}var o=t("./_castSlice"),i=t("./_hasUnicode"),a=t("./_stringToArray"),s=t("./toString");e.exports=r},{"./_castSlice":277,"./_hasUnicode":332,"./_stringToArray":392,"./toString":477}],298:[function(t,e,n){function r(t){return function(e){return o(a(i(e).replace(s,"")),t,"")}}var o=t("./_arrayReduce"),i=t("./deburr"),a=t("./words"),s=RegExp("[']","g");e.exports=r},{"./_arrayReduce":224,"./deburr":408,"./words":480}],299:[function(t,e,n){function r(t){return function(){var e=arguments
;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=o(t.prototype),r=t.apply(n,e);return i(r)?r:n}}var o=t("./_baseCreate"),i=t("./isObject");e.exports=r},{"./_baseCreate":234,"./isObject":451}],300:[function(t,e,n){function r(t,e,n){function r(){for(var i=arguments.length,p=Array(i),d=i,h=u(r);d--;)p[d]=arguments[d];var m=i<3&&p[0]!==h&&p[i-1]!==h?[]:c(p,h);return(i-=m.length)<n?s(t,e,a,r.placeholder,void 0,p,m,void 0,void 0,n-i):o(this&&this!==l&&this instanceof r?f:t,this,p)}var f=i(t);return r}var o=t("./_apply"),i=t("./_createCtor"),a=t("./_createHybrid"),s=t("./_createRecurry"),u=t("./_getHolder"),c=t("./_replaceHolders"),l=t("./_root");e.exports=r},{"./_apply":216,"./_createCtor":299,"./_createHybrid":302,"./_createRecurry":305,"./_getHolder":320,"./_replaceHolders":377,"./_root":378}],301:[function(t,e,n){function r(t){return i(function(e){var n=e.length,r=n,i=o.prototype.thru;for(t&&e.reverse();r--;){var m=e[r];if("function"!=typeof m)throw new TypeError(l);if(i&&!g&&"wrapper"==s(m))var g=new o([],!0)}for(r=g?r:n;++r<n;){m=e[r];var v=s(m),b="wrapper"==v?a(m):void 0;g=b&&c(b[0])&&b[1]==(d|f|p|h)&&!b[4].length&&1==b[9]?g[s(b[0])].apply(g,b[3]):1==m.length&&c(m)?g[v]():g.thru(m)}return function(){var t=arguments,r=t[0];if(g&&1==t.length&&u(r))return g.plant(r).value();for(var o=0,i=n?e[o].apply(this,t):r;++o<n;)i=e[o].call(this,i);return i}})}var o=t("./_LodashWrapper"),i=t("./_flatRest"),a=t("./_getData"),s=t("./_getFuncName"),u=t("./isArray"),c=t("./_isLaziable"),l="Expected a function",f=8,p=32,d=128,h=256;e.exports=r},{"./_LodashWrapper":204,"./_flatRest":314,"./_getData":318,"./_getFuncName":319,"./_isLaziable":348,"./isArray":444}],302:[function(t,e,n){function r(t,e,n,y,_,x,w,S,O,A){function E(){for(var d=arguments.length,h=Array(d),m=d;m--;)h[m]=arguments[m];if(C)var g=c(E),v=a(h,g);if(y&&(h=o(h,y,_,C)),x&&(h=i(h,x,w,C)),d-=v,C&&d<A){var b=f(h,g);return u(t,e,r,E.placeholder,n,h,b,S,O,A-d)}var k=P?n:this,I=T?k[t]:t;return d=h.length,S?h=l(h,S):R&&d>1&&h.reverse(),j&&O<d&&(h.length=O),this&&this!==p&&this instanceof E&&(I=N||s(I)),I.apply(k,h)}var j=e&v,P=e&d,T=e&h,C=e&(m|g),R=e&b,N=T?void 0:s(t);return E}var o=t("./_composeArgs"),i=t("./_composeArgsRight"),a=t("./_countHolders"),s=t("./_createCtor"),u=t("./_createRecurry"),c=t("./_getHolder"),l=t("./_reorder"),f=t("./_replaceHolders"),p=t("./_root"),d=1,h=2,m=8,g=16,v=128,b=512;e.exports=r},{"./_composeArgs":286,"./_composeArgsRight":287,"./_countHolders":293,"./_createCtor":299,"./_createRecurry":305,"./_getHolder":320,"./_reorder":376,"./_replaceHolders":377,"./_root":378}],303:[function(t,e,n){function r(t,e,n,r){function u(){for(var e=-1,i=arguments.length,s=-1,f=r.length,p=Array(f+i),d=this&&this!==a&&this instanceof u?l:t;++s<f;)p[s]=r[s];for(;i--;)p[s++]=arguments[++e];return o(d,c?n:this,p)}var c=e&s,l=i(t);return u}var o=t("./_apply"),i=t("./_createCtor"),a=t("./_root"),s=1;e.exports=r},{"./_apply":216,"./_createCtor":299,"./_root":378}],304:[function(t,e,n){function r(t){return function(e,n,r){return r&&"number"!=typeof r&&i(e,n,r)&&(n=r=void 0),e=a(e),void 0===n?(n=e,e=0):n=a(n),r=void 0===r?e<n?1:-1:a(r),o(e,n,r,t)}}var o=t("./_baseRange"),i=t("./_isIterateeCall"),a=t("./toFinite");e.exports=r},{"./_baseRange":264,"./_isIterateeCall":345,"./toFinite":473}],305:[function(t,e,n){function r(t,e,n,r,d,h,m,g,v,b){var y=e&l,_=y?m:void 0,x=y?void 0:m,w=y?h:void 0,S=y?void 0:h;e|=y?f:p,(e&=~(y?p:f))&c||(e&=~(s|u));var O=[t,e,d,w,_,S,x,g,v,b],A=n.apply(void 0,O);return o(t)&&i(A,O),A.placeholder=r,a(A,t,e)}var o=t("./_isLaziable"),i=t("./_setData"),a=t("./_setWrapToString"),s=1,u=2,c=4,l=8,f=32,p=64;e.exports=r},{"./_isLaziable":348,"./_setData":381,"./_setWrapToString":384}],306:[function(t,e,n){var r=t("./_Set"),o=t("./noop"),i=t("./_setToArray"),a=r&&1/i(new r([,-0]))[1]==1/0?function(t){return new r(t)}:o;e.exports=a},{"./_Set":208,"./_setToArray":382,"./noop":462}],307:[function(t,e,n){function r(t,e,n,r,w,S,O,A){var E=e&g;if(!E&&"function"!=typeof t)throw new TypeError(h);var j=r?r.length:0;if(j||(e&=~(y|_),r=w=void 0),O=void 0===O?O:x(d(O),0),A=void 0===A?A:d(A),j-=w?w.length:0,e&_){var P=r,T=w;r=w=void 0}var C=E?void 0:c(t),R=[t,e,n,r,w,P,T,S,O,A];if(C&&l(R,C),t=R[0],e=R[1],n=R[2],r=R[3],w=R[4],A=R[9]=void 0===R[9]?E?0:t.length:x(R[9]-j,0),!A&&e&(v|b)&&(e&=~(v|b)),e&&e!=m)N=e==v||e==b?a(t,e,A):e!=y&&e!=(m|y)||w.length?s.apply(void 0,R):u(t,e,n,r);else var N=i(t,e,n);return p((C?o:f)(N,R),t,e)}var o=t("./_baseSetData"),i=t("./_createBind"),a=t("./_createCurry"),s=t("./_createHybrid"),u=t("./_createPartial"),c=t("./_getData"),l=t("./_mergeData"),f=t("./_setData"),p=t("./_setWrapToString"),d=t("./toInteger"),h="Expected a function",m=1,g=2,v=8,b=16,y=32,_=64,x=Math.max;e.exports=r},{"./_baseSetData":267,"./_createBind":296,"./_createCurry":300,"./_createHybrid":302,"./_createPartial":303,"./_getData":318,"./_mergeData":365,"./_setData":381,"./_setWrapToString":384,"./toInteger":474}],308:[function(t,e,n){function r(t){return o(t)?void 0:t}var o=t("./isPlainObject");e.exports=r},{"./isPlainObject":453}],309:[function(t,e,n){var r=t("./_basePropertyOf"),o={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},i=r(o);e.exports=i},{"./_basePropertyOf":263}],310:[function(t,e,n){var r=t("./_getNative"),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();e.exports=o},{"./_getNative":323}],311:[function(t,e,n){function r(t,e,n,r,c,l){var f=n&s,p=t.length,d=e.length;if(p!=d&&!(f&&d>p))return!1;var h=l.get(t);if(h&&l.get(e))return h==e;var m=-1,g=!0,v=n&u?new o:void 0;for(l.set(t,e),l.set(e,t);++m<p;){var b=t[m],y=e[m];if(r)var _=f?r(y,b,m,e,t,l):r(b,y,m,t,e,l);if(void 0!==_){if(_)continue;g=!1;break}if(v){if(!i(e,function(t,e){if(!a(v,e)&&(b===t||c(b,t,n,r,l)))return v.push(e)})){g=!1;break}}else if(b!==y&&!c(b,y,n,r,l)){g=!1;break}}return l.delete(t),l.delete(e),g}var o=t("./_SetCache"),i=t("./_arraySome"),a=t("./_cacheHas"),s=1,u=2;e.exports=r},{"./_SetCache":209,"./_arraySome":225,"./_cacheHas":275}],312:[function(t,e,n){function r(t,e,n,r,o,S,A){switch(n){case w:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!S(new i(t),new i(e)));case p:case d:case g:return a(+t,+e);case h:return t.name==e.name&&t.message==e.message;case v:case y:return t==e+"";case m:var E=u;case b:var j=r&l;if(E||(E=c),t.size!=e.size&&!j)return!1;var P=A.get(t);if(P)return P==e;r|=f,A.set(t,e);var T=s(E(t),E(e),r,o,S,A);return A.delete(t),T;case _:if(O)return O.call(t)==O.call(e)}return!1}var o=t("./_Symbol"),i=t("./_Uint8Array"),a=t("./eq"),s=t("./_equalArrays"),u=t("./_mapToArray"),c=t("./_setToArray"),l=1,f=2,p="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Map]",g="[object Number]",v="[object RegExp]",b="[object Set]",y="[object String]",_="[object Symbol]",x="[object ArrayBuffer]",w="[object DataView]",S=o?o.prototype:void 0,O=S?S.valueOf:void 0;e.exports=r},{"./_Symbol":211,"./_Uint8Array":212,"./_equalArrays":311,"./_mapToArray":362,"./_setToArray":382,"./eq":409}],313:[function(t,e,n){function r(t,e,n,r,a,u){var c=n&i,l=o(t),f=l.length;if(f!=o(e).length&&!c)return!1;for(var p=f;p--;){var d=l[p];if(!(c?d in e:s.call(e,d)))return!1}var h=u.get(t);if(h&&u.get(e))return h==e;var m=!0;u.set(t,e),u.set(e,t);for(var g=c;++p<f;){d=l[p];var v=t[d],b=e[d];if(r)var y=c?r(b,v,d,e,t,u):r(v,b,d,t,e,u);if(!(void 0===y?v===b||a(v,b,n,r,u):y)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var _=t.constructor,x=e.constructor;_!=x&&"constructor"in t&&"constructor"in e&&!("function"==typeof _&&_ instanceof _&&"function"==typeof x&&x instanceof x)&&(m=!1)}return u.delete(t),u.delete(e),m}var o=t("./_getAllKeys"),i=1,a=Object.prototype,s=a.hasOwnProperty;e.exports=r},{"./_getAllKeys":316}],314:[function(t,e,n){function r(t){return a(i(t,void 0,o),t+"")}var o=t("./flatten"),i=t("./_overRest"),a=t("./_setToString");e.exports=r},{"./_overRest":373,"./_setToString":383,"./flatten":414}],315:[function(t,e,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],316:[function(t,e,n){function r(t){return o(t,a,i)}var o=t("./_baseGetAllKeys"),i=t("./_getSymbols"),a=t("./keys");e.exports=r},{"./_baseGetAllKeys":242,"./_getSymbols":326,"./keys":457}],317:[function(t,e,n){function r(t){return o(t,a,i)}var o=t("./_baseGetAllKeys"),i=t("./_getSymbolsIn"),a=t("./keysIn");e.exports=r},{"./_baseGetAllKeys":242,"./_getSymbolsIn":327,"./keysIn":458}],318:[function(t,e,n){var r=t("./_metaMap"),o=t("./noop"),i=r?function(t){return r.get(t)}:o;e.exports=i},{"./_metaMap":366,"./noop":462}],319:[function(t,e,n){function r(t){for(var e=t.name+"",n=o[e],r=a.call(o,e)?n.length:0;r--;){var i=n[r],s=i.func;if(null==s||s==t)return i.name}return e}var o=t("./_realNames"),i=Object.prototype,a=i.hasOwnProperty;e.exports=r},{"./_realNames":375}],320:[function(t,e,n){function r(t){return t.placeholder}e.exports=r},{}],321:[function(t,e,n){function r(t,e){var n=t.__data__;return o(e)?n["string"==typeof e?"string":"hash"]:n.map}var o=t("./_isKeyable");e.exports=r},{"./_isKeyable":347}],322:[function(t,e,n){function r(t){for(var e=i(t),n=e.length;n--;){var r=e[n],a=t[r];e[n]=[r,a,o(a)]}return e}var o=t("./_isStrictComparable"),i=t("./keys");e.exports=r},{"./_isStrictComparable":351,"./keys":457}],323:[function(t,e,n){function r(t,e){var n=i(t,e);return o(n)?n:void 0}var o=t("./_baseIsNative"),i=t("./_getValue");e.exports=r},{"./_baseIsNative":251,"./_getValue":329}],324:[function(t,e,n){var r=t("./_overArg"),o=r(Object.getPrototypeOf,Object);e.exports=o},{"./_overArg":372}],325:[function(t,e,n){function r(t){var e=a.call(t,u),n=t[u];try{t[u]=void 0;var r=!0}catch(t){}var o=s.call(t);return r&&(e?t[u]=n:delete t[u]),o}var o=t("./_Symbol"),i=Object.prototype,a=i.hasOwnProperty,s=i.toString,u=o?o.toStringTag:void 0;e.exports=r},{"./_Symbol":211}],326:[function(t,e,n){var r=t("./_arrayFilter"),o=t("./stubArray"),i=Object.prototype,a=i.propertyIsEnumerable,s=Object.getOwnPropertySymbols,u=s?function(t){return null==t?[]:(t=Object(t),r(s(t),function(e){return a.call(t,e)}))}:o;e.exports=u},{"./_arrayFilter":218,"./stubArray":471}],327:[function(t,e,n){var r=t("./_arrayPush"),o=t("./_getPrototype"),i=t("./_getSymbols"),a=t("./stubArray"),s=Object.getOwnPropertySymbols,u=s?function(t){for(var e=[];t;)r(e,i(t)),t=o(t);return e}:a;e.exports=u},{"./_arrayPush":223,"./_getPrototype":324,"./_getSymbols":326,"./stubArray":471}],328:[function(t,e,n){var r=t("./_DataView"),o=t("./_Map"),i=t("./_Promise"),a=t("./_Set"),s=t("./_WeakMap"),u=t("./_baseGetTag"),c=t("./_toSource"),l=c(r),f=c(o),p=c(i),d=c(a),h=c(s),m=u;(r&&"[object DataView]"!=m(new r(new ArrayBuffer(1)))||o&&"[object Map]"!=m(new o)||i&&"[object Promise]"!=m(i.resolve())||a&&"[object Set]"!=m(new a)||s&&"[object WeakMap]"!=m(new s))&&(m=function(t){var e=u(t),n="[object Object]"==e?t.constructor:void 0,r=n?c(n):"";if(r)switch(r){case l:return"[object DataView]";case f:return"[object Map]";case p:return"[object Promise]";case d:return"[object Set]";case h:return"[object WeakMap]"}return e}),e.exports=m},{"./_DataView":200,"./_Map":205,"./_Promise":207,"./_Set":208,"./_WeakMap":213,"./_baseGetTag":243,"./_toSource":395}],329:[function(t,e,n){function r(t,e){return null==t?void 0:t[e]}e.exports=r},{}],330:[function(t,e,n){function r(t){var e=t.match(o);return e?e[1].split(i):[]}var o=/\{\n\/\* \[wrapped with (.+)\] \*/,i=/,? & /;e.exports=r},{}],331:[function(t,e,n){function r(t,e,n){e=o(e,t);for(var r=-1,l=e.length,f=!1;++r<l;){var p=c(e[r]);if(!(f=null!=t&&n(t,p)))break;t=t[p]}return f||++r!=l?f:!!(l=null==t?0:t.length)&&u(l)&&s(p,l)&&(a(t)||i(t))}var o=t("./_castPath"),i=t("./isArguments"),a=t("./isArray"),s=t("./_isIndex"),u=t("./isLength"),c=t("./_toKey");e.exports=r},{"./_castPath":276,"./_isIndex":344,"./_toKey":394,"./isArguments":443,"./isArray":444,"./isLength":450}],332:[function(t,e,n){function r(t){return o.test(t)}var o=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=r},{}],333:[function(t,e,n){function r(t){return o.test(t)}var o=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=r},{}],334:[function(t,e,n){function r(){this.__data__=o?o(null):{},this.size=0}var o=t("./_nativeCreate");e.exports=r},{"./_nativeCreate":367}],335:[function(t,e,n){function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}e.exports=r},{}],336:[function(t,e,n){function r(t){var e=this.__data__;if(o){var n=e[t];return n===i?void 0:n}return s.call(e,t)?e[t]:void 0}var o=t("./_nativeCreate"),i="__lodash_hash_undefined__",a=Object.prototype,s=a.hasOwnProperty;e.exports=r},{"./_nativeCreate":367}],337:[function(t,e,n){function r(t){var e=this.__data__;return o?void 0!==e[t]:a.call(e,t)}var o=t("./_nativeCreate"),i=Object.prototype,a=i.hasOwnProperty;e.exports=r},{"./_nativeCreate":367}],338:[function(t,e,n){function r(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=o&&void 0===e?i:e,this}var o=t("./_nativeCreate"),i="__lodash_hash_undefined__";e.exports=r},{"./_nativeCreate":367}],339:[function(t,e,n){function r(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&i.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var o=Object.prototype,i=o.hasOwnProperty;e.exports=r},{}],340:[function(t,e,n){function r(t,e,n,r){var C=t.constructor;switch(e){case y:return o(t);case f:case p:return new C(+t);case _:return i(t,r);case x:case w:case S:case O:case A:case E:case j:case P:case T:return l(t,r);case d:return a(t,r,n);case h:case v:return new C(t);case m:return s(t);case g:return u(t,r,n);case b:return c(t)}}var o=t("./_cloneArrayBuffer"),i=t("./_cloneDataView"),a=t("./_cloneMap"),s=t("./_cloneRegExp"),u=t("./_cloneSet"),c=t("./_cloneSymbol"),l=t("./_cloneTypedArray"),f="[object Boolean]",p="[object Date]",d="[object Map]",h="[object Number]",m="[object RegExp]",g="[object Set]",v="[object String]",b="[object Symbol]",y="[object ArrayBuffer]",_="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",S="[object Int8Array]",O="[object Int16Array]",A="[object Int32Array]",E="[object Uint8Array]",j="[object Uint8ClampedArray]",P="[object Uint16Array]",T="[object Uint32Array]";e.exports=r},{"./_cloneArrayBuffer":278,"./_cloneDataView":280,"./_cloneMap":281,"./_cloneRegExp":282,"./_cloneSet":283,"./_cloneSymbol":284,"./_cloneTypedArray":285}],341:[function(t,e,n){function r(t){return"function"!=typeof t.constructor||a(t)?{}:o(i(t))}var o=t("./_baseCreate"),i=t("./_getPrototype"),a=t("./_isPrototype");e.exports=r},{"./_baseCreate":234,"./_getPrototype":324,"./_isPrototype":350}],342:[function(t,e,n){function r(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(o,"{\n/* [wrapped with "+e+"] */\n")}var o=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=r},{}],343:[function(t,e,n){function r(t){return a(t)||i(t)||!!(s&&t&&t[s])}var o=t("./_Symbol"),i=t("./isArguments"),a=t("./isArray"),s=o?o.isConcatSpreadable:void 0;e.exports=r},{"./_Symbol":211,"./isArguments":443,"./isArray":444}],344:[function(t,e,n){function r(t,e){return!!(e=null==e?o:e)&&("number"==typeof t||i.test(t))&&t>-1&&t%1==0&&t<e}var o=9007199254740991,i=/^(?:0|[1-9]\d*)$/;e.exports=r},{}],345:[function(t,e,n){function r(t,e,n){if(!s(n))return!1;var r=typeof e;return!!("number"==r?i(n)&&a(e,n.length):"string"==r&&e in n)&&o(n[e],t)}var o=t("./eq"),i=t("./isArrayLike"),a=t("./_isIndex"),s=t("./isObject");e.exports=r},{"./_isIndex":344,"./eq":409,"./isArrayLike":445,"./isObject":451}],346:[function(t,e,n){function r(t,e){if(o(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!i(t))||(s.test(t)||!a.test(t)||null!=e&&t in Object(e))}var o=t("./isArray"),i=t("./isSymbol"),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=r},{"./isArray":444,"./isSymbol":454}],347:[function(t,e,n){function r(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}e.exports=r},{}],348:[function(t,e,n){function r(t){var e=a(t),n=s[e];if("function"!=typeof n||!(e in o.prototype))return!1;if(t===n)return!0;var r=i(n);return!!r&&t===r[0]}var o=t("./_LazyWrapper"),i=t("./_getData"),a=t("./_getFuncName"),s=t("./wrapperLodash");e.exports=r},{"./_LazyWrapper":202,"./_getData":318,"./_getFuncName":319,"./wrapperLodash":481}],349:[function(t,e,n){function r(t){return!!i&&i in t}var o=t("./_coreJsData"),i=function(){var t=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();e.exports=r},{"./_coreJsData":292}],350:[function(t,e,n){function r(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||o)}var o=Object.prototype;e.exports=r},{}],351:[function(t,e,n){function r(t){return t===t&&!o(t)}var o=t("./isObject");e.exports=r},{"./isObject":451}],352:[function(t,e,n){function r(){this.__data__=[],this.size=0}e.exports=r},{}],353:[function(t,e,n){function r(t){var e=this.__data__,n=o(e,t);return!(n<0)&&(n==e.length-1?e.pop():a.call(e,n,1),--this.size,!0)}var o=t("./_assocIndexOf"),i=Array.prototype,a=i.splice;e.exports=r},{"./_assocIndexOf":229}],354:[function(t,e,n){function r(t){var e=this.__data__,n=o(e,t);return n<0?void 0:e[n][1]}var o=t("./_assocIndexOf");e.exports=r},{"./_assocIndexOf":229}],355:[function(t,e,n){function r(t){return o(this.__data__,t)>-1}var o=t("./_assocIndexOf");e.exports=r},{"./_assocIndexOf":229}],356:[function(t,e,n){function r(t,e){var n=this.__data__,r=o(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var o=t("./_assocIndexOf");e.exports=r},{"./_assocIndexOf":229}],357:[function(t,e,n){function r(){this.size=0,this.__data__={hash:new o,map:new(a||i),string:new o}}var o=t("./_Hash"),i=t("./_ListCache"),a=t("./_Map");e.exports=r},{"./_Hash":201,"./_ListCache":203,"./_Map":205}],358:[function(t,e,n){function r(t){var e=o(this,t).delete(t);return this.size-=e?1:0,e}var o=t("./_getMapData");e.exports=r},{"./_getMapData":321}],359:[function(t,e,n){function r(t){return o(this,t).get(t)}var o=t("./_getMapData");e.exports=r},{"./_getMapData":321}],360:[function(t,e,n){function r(t){return o(this,t).has(t)}var o=t("./_getMapData");e.exports=r},{"./_getMapData":321}],361:[function(t,e,n){function r(t,e){var n=o(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var o=t("./_getMapData");e.exports=r},{"./_getMapData":321}],362:[function(t,e,n){function r(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}e.exports=r},{}],363:[function(t,e,n){function r(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}e.exports=r},{}],364:[function(t,e,n){function r(t){var e=o(t,function(t){return n.size===i&&n.clear(),t}),n=e.cache;return e}var o=t("./memoize"),i=500;e.exports=r},{"./memoize":461}],365:[function(t,e,n){function r(t,e){var n=t[1],r=e[1],m=n|r,g=m<(u|c|p),v=r==p&&n==f||r==p&&n==d&&t[7].length<=e[8]||r==(p|d)&&e[7].length<=e[8]&&n==f;if(!g&&!v)return t;r&u&&(t[2]=e[2],m|=n&u?0:l);var b=e[3];if(b){var y=t[3];t[3]=y?o(y,b,e[4]):b,t[4]=y?a(t[3],s):e[4]}return b=e[5],b&&(y=t[5],t[5]=y?i(y,b,e[6]):b,t[6]=y?a(t[5],s):e[6]),b=e[7],b&&(t[7]=b),r&p&&(t[8]=null==t[8]?e[8]:h(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=m,t}var o=t("./_composeArgs"),i=t("./_composeArgsRight"),a=t("./_replaceHolders"),s="__lodash_placeholder__",u=1,c=2,l=4,f=8,p=128,d=256,h=Math.min;e.exports=r},{"./_composeArgs":286,"./_composeArgsRight":287,"./_replaceHolders":377}],366:[function(t,e,n){var r=t("./_WeakMap"),o=r&&new r;e.exports=o},{"./_WeakMap":213}],367:[function(t,e,n){var r=t("./_getNative"),o=r(Object,"create");e.exports=o},{"./_getNative":323}],368:[function(t,e,n){var r=t("./_overArg"),o=r(Object.keys,Object);e.exports=o},{"./_overArg":372}],369:[function(t,e,n){function r(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}e.exports=r},{}],370:[function(t,e,n){var r=t("./_freeGlobal"),o="object"==typeof n&&n&&!n.nodeType&&n,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=i&&i.exports===o,s=a&&r.process,u=function(){try{return s&&s.binding&&s.binding("util")}catch(t){}}();e.exports=u},{"./_freeGlobal":315}],371:[function(t,e,n){function r(t){return i.call(t)}var o=Object.prototype,i=o.toString;e.exports=r},{}],372:[function(t,e,n){function r(t,e){return function(n){return t(e(n))}}e.exports=r},{}],373:[function(t,e,n){function r(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var r=arguments,a=-1,s=i(r.length-e,0),u=Array(s);++a<s;)u[a]=r[e+a];a=-1;for(var c=Array(e+1);++a<e;)c[a]=r[a];return c[e]=n(u),o(t,this,c)}}var o=t("./_apply"),i=Math.max;e.exports=r},{"./_apply":216}],374:[function(t,e,n){function r(t,e){return e.length<2?t:o(t,i(e,0,-1))}var o=t("./_baseGet"),i=t("./_baseSlice");e.exports=r},{"./_baseGet":241,"./_baseSlice":269}],375:[function(t,e,n){var r={};e.exports=r},{}],376:[function(t,e,n){function r(t,e){for(var n=t.length,r=a(e.length,n),s=o(t);r--;){var u=e[r];t[r]=i(u,n)?s[u]:void 0}return t}var o=t("./_copyArray"),i=t("./_isIndex"),a=Math.min;e.exports=r},{"./_copyArray":288,"./_isIndex":344}],377:[function(t,e,n){function r(t,e){for(var n=-1,r=t.length,i=0,a=[];++n<r;){var s=t[n];s!==e&&s!==o||(t[n]=o,a[i++]=n)}return a}var o="__lodash_placeholder__";e.exports=r},{}],378:[function(t,e,n){var r=t("./_freeGlobal"),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},{"./_freeGlobal":315}],379:[function(t,e,n){function r(t){return this.__data__.set(t,o),this}var o="__lodash_hash_undefined__";e.exports=r},{}],380:[function(t,e,n){function r(t){return this.__data__.has(t)}e.exports=r},{}],381:[function(t,e,n){var r=t("./_baseSetData"),o=t("./_shortOut"),i=o(r);e.exports=i},{"./_baseSetData":267,"./_shortOut":385}],382:[function(t,e,n){function r(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}e.exports=r},{}],383:[function(t,e,n){var r=t("./_baseSetToString"),o=t("./_shortOut"),i=o(r);e.exports=i},{"./_baseSetToString":268,"./_shortOut":385}],384:[function(t,e,n){function r(t,e,n){var r=e+"";return a(t,i(r,s(o(r),n)))}var o=t("./_getWrapDetails"),i=t("./_insertWrapDetails"),a=t("./_setToString"),s=t("./_updateWrapDetails");e.exports=r},{"./_getWrapDetails":330,"./_insertWrapDetails":342,"./_setToString":383,"./_updateWrapDetails":398}],385:[function(t,e,n){function r(t){var e=0,n=0;return function(){var r=a(),s=i-(r-n);if(n=r,s>0){if(++e>=o)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var o=800,i=16,a=Date.now;e.exports=r},{}],386:[function(t,e,n){function r(){this.__data__=new o,this.size=0}var o=t("./_ListCache");e.exports=r},{"./_ListCache":203}],387:[function(t,e,n){function r(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}e.exports=r},{}],388:[function(t,e,n){function r(t){return this.__data__.get(t)}e.exports=r},{}],389:[function(t,e,n){function r(t){return this.__data__.has(t)}e.exports=r},{}],390:[function(t,e,n){function r(t,e){var n=this.__data__;if(n instanceof o){var r=n.__data__;if(!i||r.length<s-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new a(r)}return n.set(t,e),this.size=n.size,this}var o=t("./_ListCache"),i=t("./_Map"),a=t("./_MapCache"),s=200;e.exports=r},{"./_ListCache":203,"./_Map":205,"./_MapCache":206}],391:[function(t,e,n){function r(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}e.exports=r},{}],392:[function(t,e,n){function r(t){return i(t)?a(t):o(t)}var o=t("./_asciiToArray"),i=t("./_hasUnicode"),a=t("./_unicodeToArray");e.exports=r},{"./_asciiToArray":226,"./_hasUnicode":332,"./_unicodeToArray":396}],393:[function(t,e,n){var r=t("./_memoizeCapped"),o=/^\./,i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,s=r(function(t){var e=[];return o.test(t)&&e.push(""),t.replace(i,function(t,n,r,o){e.push(r?o.replace(a,"$1"):n||t)}),e});e.exports=s},{"./_memoizeCapped":364}],394:[function(t,e,n){function r(t){if("string"==typeof t||o(t))return t;var e=t+"";return"0"==e&&1/t==-i?"-0":e}var o=t("./isSymbol"),i=1/0;e.exports=r},{"./isSymbol":454}],395:[function(t,e,n){function r(t){if(null!=t){try{return i.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var o=Function.prototype,i=o.toString;e.exports=r},{}],396:[function(t,e,n){function r(t){return t.match(p)||[]}var o="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",i="\\ud83c[\\udffb-\\udfff]",a="(?:\\ud83c[\\udde6-\\uddff]){2}",s="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",c="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",a,s].join("|")+")[\\ufe0e\\ufe0f]?"+u+")*",l="[\\ufe0e\\ufe0f]?"+u+c,f="(?:"+["[^\\ud800-\\udfff]"+o+"?",o,a,s,"[\\ud800-\\udfff]"].join("|")+")",p=RegExp(i+"(?="+i+")|"+f+l,"g");e.exports=r},{}],397:[function(t,e,n){function r(t){return t.match(g)||[]}var o="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",i="["+o+"]",a="[a-z\\xdf-\\xf6\\xf8-\\xff]",s="[^\\ud800-\\udfff"+o+"\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",u="(?:\\ud83c[\\udde6-\\uddff]){2}",c="[\\ud800-\\udbff][\\udc00-\\udfff]",l="[A-Z\\xc0-\\xd6\\xd8-\\xde]",f="(?:"+a+"|"+s+")",p="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",d="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",u,c].join("|")+")[\\ufe0e\\ufe0f]?"+p+")*",h="[\\ufe0e\\ufe0f]?"+p+d,m="(?:"+["[\\u2700-\\u27bf]",u,c].join("|")+")"+h,g=RegExp([l+"?"+a+"+(?:['](?:d|ll|m|re|s|t|ve))?(?="+[i,l,"$"].join("|")+")","(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['](?:D|LL|M|RE|S|T|VE))?(?="+[i,l+f,"$"].join("|")+")",l+"?"+f+"+(?:['](?:d|ll|m|re|s|t|ve))?",l+"+(?:['](?:D|LL|M|RE|S|T|VE))?","\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)","\\d+",m].join("|"),"g");e.exports=r},{}],398:[function(t,e,n){function r(t,e){return o(a,function(n){var r="_."+n[0];e&n[1]&&!i(t,r)&&t.push(r)}),t.sort()}var o=t("./_arrayEach"),i=t("./_arrayIncludes"),a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]];e.exports=r},{"./_arrayEach":217,"./_arrayIncludes":219}],399:[function(t,e,n){function r(t){if(t instanceof o)return t.clone();var e=new i(t.__wrapped__,t.__chain__);return e.__actions__=a(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var o=t("./_LazyWrapper"),i=t("./_LodashWrapper"),a=t("./_copyArray");e.exports=r},{"./_LazyWrapper":202,"./_LodashWrapper":204,"./_copyArray":288}],400:[function(t,e,n){function r(t,e,n){return e=n?void 0:e,e=t&&null==e?t.length:e,o(t,i,void 0,void 0,void 0,void 0,e)}var o=t("./_createWrap"),i=128;e.exports=r},{"./_createWrap":307}],401:[function(t,e,n){var r=t("./capitalize"),o=t("./_createCompounder"),i=o(function(t,e,n){return e=e.toLowerCase(),t+(n?r(e):e)});e.exports=i},{"./_createCompounder":298,"./capitalize":402}],402:[function(t,e,n){function r(t){return i(o(t).toLowerCase())}var o=t("./toString"),i=t("./upperFirst");e.exports=r},{"./toString":477,"./upperFirst":479}],403:[function(t,e,n){function r(t,e,n){e=(n?i(t,e,n):void 0===e)?1:u(a(e),0);var r=null==t?0:t.length;if(!r||e<1)return[];for(var c=0,l=0,f=Array(s(r/e));c<r;)f[l++]=o(t,c,c+=e);return f}var o=t("./_baseSlice"),i=t("./_isIterateeCall"),a=t("./toInteger"),s=Math.ceil,u=Math.max;e.exports=r},{"./_baseSlice":269,"./_isIterateeCall":345,"./toInteger":474}],404:[function(t,e,n){function r(t){return o(t,i)}var o=t("./_baseClone"),i=4;e.exports=r},{"./_baseClone":233}],405:[function(t,e,n){function r(t){return function(){return t}}e.exports=r},{}],406:[function(t,e,n){function r(t,e,n){e=n?void 0:e;var a=o(t,i,void 0,void 0,void 0,void 0,void 0,e);return a.placeholder=r.placeholder,a}var o=t("./_createWrap"),i=8;r.placeholder={},e.exports=r},{"./_createWrap":307}],407:[function(t,e,n){function r(t,e,n){function r(e){var n=b,r=y;return b=y=void 0,O=e,x=t.apply(r,n)}function l(t){return O=t,w=setTimeout(d,e),A?r(t):x}function f(t){var n=t-S,r=t-O,o=e-n;return E?c(o,_-r):o}function p(t){var n=t-S,r=t-O;return void 0===S||n>=e||n<0||E&&r>=_}function d(){var t=i();if(p(t))return h(t);w=setTimeout(d,f(t))}function h(t){return w=void 0,j&&b?r(t):(b=y=void 0,x)}function m(){void 0!==w&&clearTimeout(w),O=0,b=S=y=w=void 0}function g(){return void 0===w?x:h(i())}function v(){var t=i(),n=p(t);if(b=arguments,y=this,S=t,n){if(void 0===w)return l(S);if(E)return w=setTimeout(d,e),r(S)}return void 0===w&&(w=setTimeout(d,e)),x}var b,y,_,x,w,S,O=0,A=!1,E=!1,j=!0;if("function"!=typeof t)throw new TypeError(s);return e=a(e)||0,o(n)&&(A=!!n.leading,E="maxWait"in n,_=E?u(a(n.maxWait)||0,e):_,j="trailing"in n?!!n.trailing:j),v.cancel=m,v.flush=g,v}var o=t("./isObject"),i=t("./now"),a=t("./toNumber"),s="Expected a function",u=Math.max,c=Math.min;e.exports=r},{"./isObject":451,"./now":463,"./toNumber":475}],408:[function(t,e,n){function r(t){return(t=i(t))&&t.replace(a,o).replace(s,"")}var o=t("./_deburrLetter"),i=t("./toString"),a=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,s=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");e.exports=r},{"./_deburrLetter":309,"./toString":477}],409:[function(t,e,n){function r(t,e){return t===e||t!==t&&e!==e}e.exports=r},{}],410:[function(t,e,n){function r(t){return t=o(t),t&&a.test(t)?t.replace(i,"\\$&"):t}var o=t("./toString"),i=/[\\^$.*+?()[\]{}|]/g,a=RegExp(i.source);e.exports=r},{"./toString":477}],411:[function(t,e,n){function r(t,e){return(s(t)?o:i)(t,a(e,3))}
var o=t("./_arrayFilter"),i=t("./_baseFilter"),a=t("./_baseIteratee"),s=t("./isArray");e.exports=r},{"./_arrayFilter":218,"./_baseFilter":236,"./_baseIteratee":253,"./isArray":444}],412:[function(t,e,n){function r(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var u=null==n?0:a(n);return u<0&&(u=s(r+u,0)),o(t,i(e,3),u)}var o=t("./_baseFindIndex"),i=t("./_baseIteratee"),a=t("./toInteger"),s=Math.max;e.exports=r},{"./_baseFindIndex":237,"./_baseIteratee":253,"./toInteger":474}],413:[function(t,e,n){function r(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var c=r-1;return void 0!==n&&(c=a(n),c=n<0?s(r+c,0):u(c,r-1)),o(t,i(e,3),c,!0)}var o=t("./_baseFindIndex"),i=t("./_baseIteratee"),a=t("./toInteger"),s=Math.max,u=Math.min;e.exports=r},{"./_baseFindIndex":237,"./_baseIteratee":253,"./toInteger":474}],414:[function(t,e,n){function r(t){return(null==t?0:t.length)?o(t,1):[]}var o=t("./_baseFlatten");e.exports=r},{"./_baseFlatten":238}],415:[function(t,e,n){var r=t("./_createFlow"),o=r();e.exports=o},{"./_createFlow":301}],416:[function(t,e,n){function r(t,e){return 2==e?function(e,n){return t.apply(void 0,arguments)}:function(e){return t.apply(void 0,arguments)}}function o(t,e){return 2==e?function(e,n){return t(e,n)}:function(e){return t(e)}}function i(t){for(var e=t?t.length:0,n=Array(e);e--;)n[e]=t[e];return n}function a(t){return function(e){return t({},e)}}function s(t,e){return function(){for(var n=arguments.length,r=n-1,o=Array(n);n--;)o[n]=arguments[n];var i=o[e],a=o.slice(0,e);return i&&p.apply(a,i),e!=r&&p.apply(a,o.slice(e+1)),t.apply(this,a)}}function u(t,e){return function(){var n=arguments.length;if(n){for(var r=Array(n);n--;)r[n]=arguments[n];var o=r[0]=e.apply(void 0,r);return t.apply(void 0,r),o}}}function c(t,e,n,p){function d(t,e){if(j.cap){var n=l.iterateeRearg[t];if(n)return x(e,n);var r=!A&&l.iterateeAry[t];if(r)return _(e,r)}return e}function h(t,e,n){return P||j.curry&&n>1?L(e,n):e}function m(t,e,n){if(j.fixed&&(T||!l.skipFixed[t])){var r=l.methodSpread[t],o=r&&r.start;return void 0===o?I(e,n):s(e,o)}return e}function g(t,e,n){return j.rearg&&n>1&&(C||!l.skipRearg[t])?U(e,l.methodRearg[t]||l.aryRearg[n]):e}function v(t,e){e=H(e);for(var n=-1,r=e.length,o=r-1,i=M(Object(t)),a=i;null!=a&&++n<r;){var s=e[n],u=a[s];null!=u&&(a[e[n]]=M(n==o?u:Object(u))),a=a[s]}return i}function b(t){return K.runInContext.convert(t)(void 0)}function y(t,e){var n=l.aliasToReal[t]||t,r=l.remap[n]||n,o=p;return function(t){var i=A?N:k,a=A?N[r]:e,s=B(B({},o),t);return c(i,n,a,s)}}function _(t,e){return w(t,function(t){return"function"==typeof t?o(t,e):t})}function x(t,e){return w(t,function(t){var n=e.length;return r(U(o(t,n),e),n)})}function w(t,e){return function(){var n=arguments.length;if(!n)return t();for(var r=Array(n);n--;)r[n]=arguments[n];var o=j.rearg?0:n-1;return r[o]=e(r[o]),t.apply(void 0,r)}}function S(t,e){var n,r=l.aliasToReal[t]||t,o=e,s=q[r];return s?o=s(e):j.immutable&&(l.mutate.array[r]?o=u(e,i):l.mutate.object[r]?o=u(e,a(e)):l.mutate.set[r]&&(o=u(e,v))),D(V,function(t){return D(l.aryMethod[t],function(e){if(r==e){var i=l.methodSpread[r],a=i&&i.afterRearg;return n=a?m(r,g(r,o,t),t):g(r,m(r,o,t),t),n=d(r,n),n=h(r,n,t),!1}}),!n}),n||(n=o),n==e&&(n=P?L(n,1):function(){return e.apply(this,arguments)}),n.convert=y(r,e),l.placeholder[r]&&(O=!0,n.placeholder=e.placeholder=R),n}var O,A="function"==typeof e,E=e===Object(e);if(E&&(p=n,n=e,e=void 0),null==n)throw new TypeError;p||(p={});var j={cap:!("cap"in p)||p.cap,curry:!("curry"in p)||p.curry,fixed:!("fixed"in p)||p.fixed,immutable:!("immutable"in p)||p.immutable,rearg:!("rearg"in p)||p.rearg},P="curry"in p&&p.curry,T="fixed"in p&&p.fixed,C="rearg"in p&&p.rearg,R=A?n:f,N=A?n.runInContext():void 0,k=A?n:{ary:t.ary,assign:t.assign,clone:t.clone,curry:t.curry,forEach:t.forEach,isArray:t.isArray,isFunction:t.isFunction,iteratee:t.iteratee,keys:t.keys,rearg:t.rearg,toInteger:t.toInteger,toPath:t.toPath},I=k.ary,B=k.assign,M=k.clone,L=k.curry,D=k.forEach,F=k.isArray,G=k.isFunction,z=k.keys,U=k.rearg,W=k.toInteger,H=k.toPath,V=z(l.aryMethod),q={castArray:function(t){return function(){var e=arguments[0];return F(e)?t(i(e)):t.apply(void 0,arguments)}},iteratee:function(t){return function(){var e=arguments[0],n=arguments[1],r=t(e,n),i=r.length;return j.cap&&"number"==typeof n?(n=n>2?n-2:1,i&&i<=n?r:o(r,n)):r}},mixin:function(t){return function(e){var n=this;if(!G(n))return t(n,Object(e));var r=[];return D(z(e),function(t){G(e[t])&&r.push([t,n.prototype[t]])}),t(n,Object(e)),D(r,function(t){var e=t[1];G(e)?n.prototype[t[0]]=e:delete n.prototype[t[0]]}),n}},nthArg:function(t){return function(e){var n=e<0?1:W(e)+1;return L(t(e),n)}},rearg:function(t){return function(e,n){var r=n?n.length:0;return L(t(e,n),r)}},runInContext:function(e){return function(n){return c(t,e(n),p)}}};if(!E)return S(e,n);var K=n,Y=[];return D(V,function(t){D(l.aryMethod[t],function(t){var e=K[l.remap[t]||t];e&&Y.push([t,S(t,e)])})}),D(z(K),function(t){var e=K[t];if("function"==typeof e){for(var n=Y.length;n--;)if(Y[n][0]==t)return;e.convert=y(t,e),Y.push([t,e])}}),D(Y,function(t){K[t[0]]=t[1]}),K.convert=b,O&&(K.placeholder=R),D(z(K),function(t){D(l.realToAlias[t]||[],function(e){K[e]=K[t]})}),K}var l=t("./_mapping"),f=t("./placeholder"),p=Array.prototype.push;e.exports=c},{"./_mapping":418,"./placeholder":435}],417:[function(t,e,n){e.exports={cap:!1,curry:!1,fixed:!1,immutable:!1,rearg:!1}},{}],418:[function(t,e,n){n.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},n.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},n.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},n.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},n.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},n.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},n.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},n.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},n.placeholder={bind:!0,bindKey:!0,curry:!0,curryRight:!0,partial:!0,partialRight:!0},n.realToAlias=function(){var t=Object.prototype.hasOwnProperty,e=n.aliasToReal,r={};for(var o in e){var i=e[o];t.call(r,i)?r[i].push(o):r[i]=[o]}return r}(),n.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},n.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},n.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},{}],419:[function(t,e,n){e.exports={ary:t("../ary"),assign:t("../_baseAssign"),clone:t("../clone"),curry:t("../curry"),forEach:t("../_arrayEach"),isArray:t("../isArray"),isFunction:t("../isFunction"),iteratee:t("../iteratee"),keys:t("../_baseKeys"),rearg:t("../rearg"),toInteger:t("../toInteger"),toPath:t("../toPath")}},{"../_arrayEach":217,"../_baseAssign":230,"../_baseKeys":254,"../ary":400,"../clone":404,"../curry":406,"../isArray":444,"../isFunction":449,"../iteratee":456,"../rearg":469,"../toInteger":474,"../toPath":476}],420:[function(t,e,n){var r=t("./convert"),o=r("camelCase",t("../camelCase"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../camelCase":401,"./_falseOptions":417,"./convert":423,"./placeholder":435}],421:[function(t,e,n){var r=t("./convert"),o=r("capitalize",t("../capitalize"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../capitalize":402,"./_falseOptions":417,"./convert":423,"./placeholder":435}],422:[function(t,e,n){var r=t("./convert"),o=r("chunk",t("../chunk"));o.placeholder=t("./placeholder"),e.exports=o},{"../chunk":403,"./convert":423,"./placeholder":435}],423:[function(t,e,n){function r(t,e,n){return o(i,t,e,n)}var o=t("./_baseConvert"),i=t("./_util");e.exports=r},{"./_baseConvert":416,"./_util":419}],424:[function(t,e,n){var r=t("./convert"),o=r("debounce",t("../debounce"));o.placeholder=t("./placeholder"),e.exports=o},{"../debounce":407,"./convert":423,"./placeholder":435}],425:[function(t,e,n){var r=t("./convert"),o=r("escapeRegExp",t("../escapeRegExp"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../escapeRegExp":410,"./_falseOptions":417,"./convert":423,"./placeholder":435}],426:[function(t,e,n){var r=t("./convert"),o=r("filter",t("../filter"));o.placeholder=t("./placeholder"),e.exports=o},{"../filter":411,"./convert":423,"./placeholder":435}],427:[function(t,e,n){var r=t("./convert"),o=r("findIndex",t("../findIndex"));o.placeholder=t("./placeholder"),e.exports=o},{"../findIndex":412,"./convert":423,"./placeholder":435}],428:[function(t,e,n){var r=t("./convert"),o=r("findLastIndex",t("../findLastIndex"));o.placeholder=t("./placeholder"),e.exports=o},{"../findLastIndex":413,"./convert":423,"./placeholder":435}],429:[function(t,e,n){var r=t("./convert"),o=r("flow",t("../flow"));o.placeholder=t("./placeholder"),e.exports=o},{"../flow":415,"./convert":423,"./placeholder":435}],430:[function(t,e,n){var r=t("./convert"),o=r("isEmpty",t("../isEmpty"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../isEmpty":447,"./_falseOptions":417,"./convert":423,"./placeholder":435}],431:[function(t,e,n){var r=t("./convert"),o=r("isEqual",t("../isEqual"));o.placeholder=t("./placeholder"),e.exports=o},{"../isEqual":448,"./convert":423,"./placeholder":435}],432:[function(t,e,n){var r=t("./convert"),o=r("omit",t("../omit"));o.placeholder=t("./placeholder"),e.exports=o},{"../omit":464,"./convert":423,"./placeholder":435}],433:[function(t,e,n){var r=t("./convert"),o=r("pick",t("../pick"));o.placeholder=t("./placeholder"),e.exports=o},{"../pick":465,"./convert":423,"./placeholder":435}],434:[function(t,e,n){var r=t("./convert"),o=r("pickBy",t("../pickBy"));o.placeholder=t("./placeholder"),e.exports=o},{"../pickBy":466,"./convert":423,"./placeholder":435}],435:[function(t,e,n){e.exports={}},{}],436:[function(t,e,n){var r=t("./convert"),o=r("range",t("../range"));o.placeholder=t("./placeholder"),e.exports=o},{"../range":468,"./convert":423,"./placeholder":435}],437:[function(t,e,n){var r=t("./convert"),o=r("reduce",t("../reduce"));o.placeholder=t("./placeholder"),e.exports=o},{"../reduce":470,"./convert":423,"./placeholder":435}],438:[function(t,e,n){var r=t("./convert"),o=r("uniq",t("../uniq"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../uniq":478,"./_falseOptions":417,"./convert":423,"./placeholder":435}],439:[function(t,e,n){var r=t("./convert"),o=r("upperFirst",t("../upperFirst"),t("./_falseOptions"));o.placeholder=t("./placeholder"),e.exports=o},{"../upperFirst":479,"./_falseOptions":417,"./convert":423,"./placeholder":435}],440:[function(t,e,n){function r(t,e,n){var r=null==t?void 0:o(t,e);return void 0===r?n:r}var o=t("./_baseGet");e.exports=r},{"./_baseGet":241}],441:[function(t,e,n){function r(t,e){return null!=t&&i(t,e,o)}var o=t("./_baseHasIn"),i=t("./_hasPath");e.exports=r},{"./_baseHasIn":244,"./_hasPath":331}],442:[function(t,e,n){function r(t){return t}e.exports=r},{}],443:[function(t,e,n){var r=t("./_baseIsArguments"),o=t("./isObjectLike"),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return o(t)&&a.call(t,"callee")&&!s.call(t,"callee")};e.exports=u},{"./_baseIsArguments":246,"./isObjectLike":452}],444:[function(t,e,n){var r=Array.isArray;e.exports=r},{}],445:[function(t,e,n){function r(t){return null!=t&&i(t.length)&&!o(t)}var o=t("./isFunction"),i=t("./isLength");e.exports=r},{"./isFunction":449,"./isLength":450}],446:[function(t,e,n){var r=t("./_root"),o=t("./stubFalse"),i="object"==typeof n&&n&&!n.nodeType&&n,a=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===i,u=s?r.Buffer:void 0,c=u?u.isBuffer:void 0,l=c||o;e.exports=l},{"./_root":378,"./stubFalse":472}],447:[function(t,e,n){function r(t){if(null==t)return!0;if(u(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||c(t)||f(t)||a(t)))return!t.length;var e=i(t);if(e==p||e==d)return!t.size;if(l(t))return!o(t).length;for(var n in t)if(m.call(t,n))return!1;return!0}var o=t("./_baseKeys"),i=t("./_getTag"),a=t("./isArguments"),s=t("./isArray"),u=t("./isArrayLike"),c=t("./isBuffer"),l=t("./_isPrototype"),f=t("./isTypedArray"),p="[object Map]",d="[object Set]",h=Object.prototype,m=h.hasOwnProperty;e.exports=r},{"./_baseKeys":254,"./_getTag":328,"./_isPrototype":350,"./isArguments":443,"./isArray":444,"./isArrayLike":445,"./isBuffer":446,"./isTypedArray":455}],448:[function(t,e,n){function r(t,e){return o(t,e)}var o=t("./_baseIsEqual");e.exports=r},{"./_baseIsEqual":247}],449:[function(t,e,n){function r(t){if(!i(t))return!1;var e=o(t);return e==s||e==u||e==a||e==c}var o=t("./_baseGetTag"),i=t("./isObject"),a="[object AsyncFunction]",s="[object Function]",u="[object GeneratorFunction]",c="[object Proxy]";e.exports=r},{"./_baseGetTag":243,"./isObject":451}],450:[function(t,e,n){function r(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}var o=9007199254740991;e.exports=r},{}],451:[function(t,e,n){function r(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}e.exports=r},{}],452:[function(t,e,n){function r(t){return null!=t&&"object"==typeof t}e.exports=r},{}],453:[function(t,e,n){function r(t){if(!a(t)||o(t)!=s)return!1;var e=i(t);if(null===e)return!0;var n=f.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==p}var o=t("./_baseGetTag"),i=t("./_getPrototype"),a=t("./isObjectLike"),s="[object Object]",u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,p=l.call(Object);e.exports=r},{"./_baseGetTag":243,"./_getPrototype":324,"./isObjectLike":452}],454:[function(t,e,n){function r(t){return"symbol"==typeof t||i(t)&&o(t)==a}var o=t("./_baseGetTag"),i=t("./isObjectLike"),a="[object Symbol]";e.exports=r},{"./_baseGetTag":243,"./isObjectLike":452}],455:[function(t,e,n){var r=t("./_baseIsTypedArray"),o=t("./_baseUnary"),i=t("./_nodeUtil"),a=i&&i.isTypedArray,s=a?o(a):r;e.exports=s},{"./_baseIsTypedArray":252,"./_baseUnary":272,"./_nodeUtil":370}],456:[function(t,e,n){function r(t){return i("function"==typeof t?t:o(t,a))}var o=t("./_baseClone"),i=t("./_baseIteratee"),a=1;e.exports=r},{"./_baseClone":233,"./_baseIteratee":253}],457:[function(t,e,n){function r(t){return a(t)?o(t):i(t)}var o=t("./_arrayLikeKeys"),i=t("./_baseKeys"),a=t("./isArrayLike");e.exports=r},{"./_arrayLikeKeys":221,"./_baseKeys":254,"./isArrayLike":445}],458:[function(t,e,n){function r(t){return a(t)?o(t,!0):i(t)}var o=t("./_arrayLikeKeys"),i=t("./_baseKeysIn"),a=t("./isArrayLike");e.exports=r},{"./_arrayLikeKeys":221,"./_baseKeysIn":255,"./isArrayLike":445}],459:[function(t,e,n){function r(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}e.exports=r},{}],460:[function(e,n,r){(function(e){(function(){function o(t,e){return t.set(e[0],e[1]),t}function i(t,e){return t.add(e),t}function a(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function s(t,e,n,r){for(var o=-1,i=null==t?0:t.length;++o<i;){var a=t[o];e(r,a,n(a),t)}return r}function u(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function c(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function l(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function f(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i}function p(t,e){return!!(null==t?0:t.length)&&S(t,e,0)>-1}function d(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1}function h(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function m(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function g(t,e,n,r){var o=-1,i=null==t?0:t.length;for(r&&i&&(n=t[++o]);++o<i;)n=e(n,t[o],o,t);return n}function v(t,e,n,r){var o=null==t?0:t.length;for(r&&o&&(n=t[--o]);o--;)n=e(n,t[o],o,t);return n}function b(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function y(t){return t.split("")}function _(t){return t.match(Fe)||[]}function x(t,e,n){var r;return n(t,function(t,n,o){if(e(t,n,o))return r=n,!1}),r}function w(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}function S(t,e,n){return e===e?Z(t,e,n):w(t,A,n)}function O(t,e,n,r){for(var o=n-1,i=t.length;++o<i;)if(r(t[o],e))return o;return-1}function A(t){return t!==t}function E(t,e){var n=null==t?0:t.length;return n?R(t,e)/n:It}function j(t){return function(e){return null==e?rt:e[t]}}function P(t){return function(e){return null==t?rt:t[e]}}function T(t,e,n,r,o){return o(t,function(t,o,i){n=r?(r=!1,t):e(n,t,o,i)}),n}function C(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}function R(t,e){for(var n,r=-1,o=t.length;++r<o;){var i=e(t[r]);i!==rt&&(n=n===rt?i:n+i)}return n}function N(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function k(t,e){return h(e,function(e){return[e,t[e]]})}function I(t){return function(e){return t(e)}}function B(t,e){return h(e,function(e){return t[e]})}function M(t,e){return t.has(e)}function L(t,e){for(var n=-1,r=t.length;++n<r&&S(e,t[n],0)>-1;);return n}function D(t,e){for(var n=t.length;n--&&S(e,t[n],0)>-1;);return n}function F(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}function G(t){return"\\"+jn[t]}function z(t,e){return null==t?rt:t[e]}function U(t){return bn.test(t)}function W(t){return yn.test(t)}function H(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function V(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function q(t,e){return function(n){return t(e(n))}}function K(t,e){for(var n=-1,r=t.length,o=0,i=[];++n<r;){var a=t[n];a!==e&&a!==ct||(t[n]=ct,i[o++]=n)}return i}function Y(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function $(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function Z(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}function X(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}function J(t){return U(t)?tt(t):Hn(t)}function Q(t){return U(t)?et(t):y(t)}function tt(t){for(var e=gn.lastIndex=0;gn.test(t);)++e;return e}function et(t){return t.match(gn)||[]}function nt(t){return t.match(vn)||[]}var rt,ot=200,it="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",at="Expected a function",st="__lodash_hash_undefined__",ut=500,ct="__lodash_placeholder__",lt=1,ft=2,pt=4,dt=1,ht=2,mt=1,gt=2,vt=4,bt=8,yt=16,_t=32,xt=64,wt=128,St=256,Ot=512,At=30,Et="...",jt=800,Pt=16,Tt=1,Ct=2,Rt=1/0,Nt=9007199254740991,kt=1.7976931348623157e308,It=NaN,Bt=4294967295,Mt=Bt-1,Lt=Bt>>>1,Dt=[["ary",wt],["bind",mt],["bindKey",gt],["curry",bt],["curryRight",yt],["flip",Ot],["partial",_t],["partialRight",xt],["rearg",St]],Ft="[object Arguments]",Gt="[object Array]",zt="[object AsyncFunction]",Ut="[object Boolean]",Wt="[object Date]",Ht="[object DOMException]",Vt="[object Error]",qt="[object Function]",Kt="[object GeneratorFunction]",Yt="[object Map]",$t="[object Number]",Zt="[object Null]",Xt="[object Object]",Jt="[object Proxy]",Qt="[object RegExp]",te="[object Set]",ee="[object String]",ne="[object Symbol]",re="[object Undefined]",oe="[object WeakMap]",ie="[object WeakSet]",ae="[object ArrayBuffer]",se="[object DataView]",ue="[object Float32Array]",ce="[object Float64Array]",le="[object Int8Array]",fe="[object Int16Array]",pe="[object Int32Array]",de="[object Uint8Array]",he="[object Uint8ClampedArray]",me="[object Uint16Array]",ge="[object Uint32Array]",ve=/\b__p \+= '';/g,be=/\b(__p \+=) '' \+/g,ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_e=/&(?:amp|lt|gt|quot|#39);/g,xe=/[&<>"']/g,we=RegExp(_e.source),Se=RegExp(xe.source),Oe=/<%-([\s\S]+?)%>/g,Ae=/<%([\s\S]+?)%>/g,Ee=/<%=([\s\S]+?)%>/g,je=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pe=/^\w*$/,Te=/^\./,Ce=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Re=/[\\^$.*+?()[\]{}|]/g,Ne=RegExp(Re.source),ke=/^\s+|\s+$/g,Ie=/^\s+/,Be=/\s+$/,Me=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Le=/\{\n\/\* \[wrapped with (.+)\] \*/,De=/,? & /,Fe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ge=/\\(\\)?/g,ze=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ue=/\w*$/,We=/^[-+]0x[0-9a-f]+$/i,He=/^0b[01]+$/i,Ve=/^\[object .+?Constructor\]$/,qe=/^0o[0-7]+$/i,Ke=/^(?:0|[1-9]\d*)$/,Ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,$e=/($^)/,Ze=/['\n\r\u2028\u2029\\]/g,Xe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Je="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Qe="["+Je+"]",tn="["+Xe+"]",en="[a-z\\xdf-\\xf6\\xf8-\\xff]",nn="[^\\ud800-\\udfff"+Je+"\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",rn="\\ud83c[\\udffb-\\udfff]",on="(?:\\ud83c[\\udde6-\\uddff]){2}",an="[\\ud800-\\udbff][\\udc00-\\udfff]",sn="[A-Z\\xc0-\\xd6\\xd8-\\xde]",un="(?:"+en+"|"+nn+")",cn="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",ln="(?:\\u200d(?:"+["[^\\ud800-\\udfff]",on,an].join("|")+")[\\ufe0e\\ufe0f]?"+cn+")*",fn="[\\ufe0e\\ufe0f]?"+cn+ln,pn="(?:"+["[\\u2700-\\u27bf]",on,an].join("|")+")"+fn,dn="(?:"+["[^\\ud800-\\udfff]"+tn+"?",tn,on,an,"[\\ud800-\\udfff]"].join("|")+")",hn=RegExp("[']","g"),mn=RegExp(tn,"g"),gn=RegExp(rn+"(?="+rn+")|"+dn+fn,"g"),vn=RegExp([sn+"?"+en+"+(?:['](?:d|ll|m|re|s|t|ve))?(?="+[Qe,sn,"$"].join("|")+")","(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['](?:D|LL|M|RE|S|T|VE))?(?="+[Qe,sn+un,"$"].join("|")+")",sn+"?"+un+"+(?:['](?:d|ll|m|re|s|t|ve))?",sn+"+(?:['](?:D|LL|M|RE|S|T|VE))?","\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)","\\d+",pn].join("|"),"g"),bn=RegExp("[\\u200d\\ud800-\\udfff"+Xe+"\\ufe0e\\ufe0f]"),yn=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_n=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],xn=-1,wn={};wn[ue]=wn[ce]=wn[le]=wn[fe]=wn[pe]=wn[de]=wn[he]=wn[me]=wn[ge]=!0,wn[Ft]=wn[Gt]=wn[ae]=wn[Ut]=wn[se]=wn[Wt]=wn[Vt]=wn[qt]=wn[Yt]=wn[$t]=wn[Xt]=wn[Qt]=wn[te]=wn[ee]=wn[oe]=!1;var Sn={};Sn[Ft]=Sn[Gt]=Sn[ae]=Sn[se]=Sn[Ut]=Sn[Wt]=Sn[ue]=Sn[ce]=Sn[le]=Sn[fe]=Sn[pe]=Sn[Yt]=Sn[$t]=Sn[Xt]=Sn[Qt]=Sn[te]=Sn[ee]=Sn[ne]=Sn[de]=Sn[he]=Sn[me]=Sn[ge]=!0,Sn[Vt]=Sn[qt]=Sn[oe]=!1;var On={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},An={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},En={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},jn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pn=parseFloat,Tn=parseInt,Cn="object"==typeof e&&e&&e.Object===Object&&e,Rn="object"==typeof self&&self&&self.Object===Object&&self,Nn=Cn||Rn||Function("return this")(),kn="object"==typeof r&&r&&!r.nodeType&&r,In=kn&&"object"==typeof n&&n&&!n.nodeType&&n,Bn=In&&In.exports===kn,Mn=Bn&&Cn.process,Ln=function(){try{return Mn&&Mn.binding&&Mn.binding("util")}catch(t){}}(),Dn=Ln&&Ln.isArrayBuffer,Fn=Ln&&Ln.isDate,Gn=Ln&&Ln.isMap,zn=Ln&&Ln.isRegExp,Un=Ln&&Ln.isSet,Wn=Ln&&Ln.isTypedArray,Hn=j("length"),Vn=P(On),qn=P(An),Kn=P(En),Yn=function t(e){function n(t){if(iu(t)&&!vp(t)&&!(t instanceof P)){if(t instanceof y)return t;if(gl.call(t,"__wrapped__"))return na(t)}return new y(t)}function r(){}function y(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=rt}function P(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Bt,this.__views__=[]}function Z(){var t=new P(this.__wrapped__);return t.__actions__=Do(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Do(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Do(this.__views__),t}function tt(){if(this.__filtered__){var t=new P(this);t.__dir__=-1,t.__filtered__=!0}else t=this.clone(),t.__dir__*=-1;return t}function et(){
var t=this.__wrapped__.value(),e=this.__dir__,n=vp(t),r=e<0,o=n?t.length:0,i=ji(0,o,this.__views__),a=i.start,s=i.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,f=l.length,p=0,d=ql(u,this.__takeCount__);if(!n||!r&&o==u&&d==u)return yo(t,this.__actions__);var h=[];t:for(;u--&&p<d;){c+=e;for(var m=-1,g=t[c];++m<f;){var v=l[m],b=v.iteratee,y=v.type,_=b(g);if(y==Ct)g=_;else if(!_){if(y==Tt)continue t;break t}}h[p++]=g}return h}function Fe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Xe(){this.__data__=nf?nf(null):{},this.size=0}function Je(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function Qe(t){var e=this.__data__;if(nf){var n=e[t];return n===st?rt:n}return gl.call(e,t)?e[t]:rt}function tn(t){var e=this.__data__;return nf?e[t]!==rt:gl.call(e,t)}function en(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=nf&&e===rt?st:e,this}function nn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function rn(){this.__data__=[],this.size=0}function on(t){var e=this.__data__,n=Zn(e,t);return!(n<0)&&(n==e.length-1?e.pop():Cl.call(e,n,1),--this.size,!0)}function an(t){var e=this.__data__,n=Zn(e,t);return n<0?rt:e[n][1]}function sn(t){return Zn(this.__data__,t)>-1}function un(t,e){var n=this.__data__,r=Zn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function cn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function ln(){this.size=0,this.__data__={hash:new Fe,map:new(Jl||nn),string:new Fe}}function fn(t){var e=Si(this,t).delete(t);return this.size-=e?1:0,e}function pn(t){return Si(this,t).get(t)}function dn(t){return Si(this,t).has(t)}function gn(t,e){var n=Si(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function vn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new cn;++e<n;)this.add(t[e])}function bn(t){return this.__data__.set(t,st),this}function yn(t){return this.__data__.has(t)}function On(t){var e=this.__data__=new nn(t);this.size=e.size}function An(){this.__data__=new nn,this.size=0}function En(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function jn(t){return this.__data__.get(t)}function Cn(t){return this.__data__.has(t)}function Rn(t,e){var n=this.__data__;if(n instanceof nn){var r=n.__data__;if(!Jl||r.length<ot-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new cn(r)}return n.set(t,e),this.size=n.size,this}function kn(t,e){var n=vp(t),r=!n&&gp(t),o=!n&&!r&&yp(t),i=!n&&!r&&!o&&Op(t),a=n||r||o||i,s=a?N(t.length,cl):[],u=s.length;for(var c in t)!e&&!gl.call(t,c)||a&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Bi(c,u))||s.push(c);return s}function In(t){var e=t.length;return e?t[Qr(0,e-1)]:rt}function Mn(t,e){return Ji(Do(t),nr(e,0,t.length))}function Ln(t){return Ji(Do(t))}function Hn(t,e,n){(n===rt||Vs(t[e],n))&&(n!==rt||e in t)||tr(t,e,n)}function $n(t,e,n){var r=t[e];gl.call(t,e)&&Vs(r,n)&&(n!==rt||e in t)||tr(t,e,n)}function Zn(t,e){for(var n=t.length;n--;)if(Vs(t[n][0],e))return n;return-1}function Xn(t,e,n,r){return mf(t,function(t,o,i){e(r,t,n(t),i)}),r}function Jn(t,e){return t&&Fo(e,Gu(e),t)}function Qn(t,e){return t&&Fo(e,zu(e),t)}function tr(t,e,n){"__proto__"==e&&Il?Il(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function er(t,e){for(var n=-1,r=e.length,o=nl(r),i=null==t;++n<r;)o[n]=i?rt:Lu(t,e[n]);return o}function nr(t,e,n){return t===t&&(n!==rt&&(t=t<=n?t:n),e!==rt&&(t=t>=e?t:e)),t}function rr(t,e,n,r,o,i){var a,s=e&lt,c=e&ft,l=e&pt;if(n&&(a=o?n(t,r,o,i):n(t)),a!==rt)return a;if(!ou(t))return t;var f=vp(t);if(f){if(a=Ci(t),!s)return Do(t,a)}else{var p=jf(t),d=p==qt||p==Kt;if(yp(t))return Eo(t,s);if(p==Xt||p==Ft||d&&!o){if(a=c||d?{}:Ri(t),!s)return c?zo(t,Qn(a,t)):Go(t,Jn(a,t))}else{if(!Sn[p])return o?t:{};a=Ni(t,p,rr,s)}}i||(i=new On);var h=i.get(t);if(h)return h;i.set(t,a);var m=l?c?yi:bi:c?zu:Gu,g=f?rt:m(t);return u(g||t,function(r,o){g&&(o=r,r=t[o]),$n(a,o,rr(r,e,n,o,t,i))}),a}function or(t){var e=Gu(t);return function(n){return ir(n,t,e)}}function ir(t,e,n){var r=n.length;if(null==t)return!r;for(t=sl(t);r--;){var o=n[r],i=e[o],a=t[o];if(a===rt&&!(o in t)||!i(a))return!1}return!0}function ar(t,e,n){if("function"!=typeof t)throw new ll(at);return Cf(function(){t.apply(rt,n)},e)}function sr(t,e,n,r){var o=-1,i=p,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=h(e,I(n))),r?(i=d,a=!1):e.length>=ot&&(i=M,a=!1,e=new vn(e));t:for(;++o<s;){var l=t[o],f=null==n?l:n(l);if(l=r||0!==l?l:0,a&&f===f){for(var m=c;m--;)if(e[m]===f)continue t;u.push(l)}else i(e,f,r)||u.push(l)}return u}function ur(t,e){var n=!0;return mf(t,function(t,r,o){return n=!!e(t,r,o)}),n}function cr(t,e,n){for(var r=-1,o=t.length;++r<o;){var i=t[r],a=e(i);if(null!=a&&(s===rt?a===a&&!gu(a):n(a,s)))var s=a,u=i}return u}function lr(t,e,n,r){var o=t.length;for(n=wu(n),n<0&&(n=-n>o?0:o+n),r=r===rt||r>o?o:wu(r),r<0&&(r+=o),r=n>r?0:Su(r);n<r;)t[n++]=e;return t}function fr(t,e){var n=[];return mf(t,function(t,r,o){e(t,r,o)&&n.push(t)}),n}function pr(t,e,n,r,o){var i=-1,a=t.length;for(n||(n=Ii),o||(o=[]);++i<a;){var s=t[i];e>0&&n(s)?e>1?pr(s,e-1,n,r,o):m(o,s):r||(o[o.length]=s)}return o}function dr(t,e){return t&&vf(t,e,Gu)}function hr(t,e){return t&&bf(t,e,Gu)}function mr(t,e){return f(e,function(e){return eu(t[e])})}function gr(t,e){e=Oo(e,t);for(var n=0,r=e.length;null!=t&&n<r;)t=t[Qi(e[n++])];return n&&n==r?t:rt}function vr(t,e,n){var r=e(t);return vp(t)?r:m(r,n(t))}function br(t){return null==t?t===rt?re:Zt:kl&&kl in sl(t)?Ei(t):qi(t)}function yr(t,e){return t>e}function _r(t,e){return null!=t&&gl.call(t,e)}function xr(t,e){return null!=t&&e in sl(t)}function wr(t,e,n){return t>=ql(e,n)&&t<Vl(e,n)}function Sr(t,e,n){for(var r=n?d:p,o=t[0].length,i=t.length,a=i,s=nl(i),u=1/0,c=[];a--;){var l=t[a];a&&e&&(l=h(l,I(e))),u=ql(l.length,u),s[a]=!n&&(e||o>=120&&l.length>=120)?new vn(a&&l):rt}l=t[0];var f=-1,m=s[0];t:for(;++f<o&&c.length<u;){var g=l[f],v=e?e(g):g;if(g=n||0!==g?g:0,!(m?M(m,v):r(c,v,n))){for(a=i;--a;){var b=s[a];if(!(b?M(b,v):r(t[a],v,n)))continue t}m&&m.push(v),c.push(g)}}return c}function Or(t,e,n,r){return dr(t,function(t,o,i){e(r,n(t),o,i)}),r}function Ar(t,e,n){e=Oo(e,t),t=Yi(t,e);var r=null==t?t:t[Qi(xa(e))];return null==r?rt:a(r,t,n)}function Er(t){return iu(t)&&br(t)==Ft}function jr(t){return iu(t)&&br(t)==ae}function Pr(t){return iu(t)&&br(t)==Wt}function Tr(t,e,n,r,o){return t===e||(null==t||null==e||!iu(t)&&!iu(e)?t!==t&&e!==e:Cr(t,e,n,r,Tr,o))}function Cr(t,e,n,r,o,i){var a=vp(t),s=vp(e),u=a?Gt:jf(t),c=s?Gt:jf(e);u=u==Ft?Xt:u,c=c==Ft?Xt:c;var l=u==Xt,f=c==Xt,p=u==c;if(p&&yp(t)){if(!yp(e))return!1;a=!0,l=!1}if(p&&!l)return i||(i=new On),a||Op(t)?hi(t,e,n,r,o,i):mi(t,e,u,n,r,o,i);if(!(n&dt)){var d=l&&gl.call(t,"__wrapped__"),h=f&&gl.call(e,"__wrapped__");if(d||h){var m=d?t.value():t,g=h?e.value():e;return i||(i=new On),o(m,g,n,r,i)}}return!!p&&(i||(i=new On),gi(t,e,n,r,o,i))}function Rr(t){return iu(t)&&jf(t)==Yt}function Nr(t,e,n,r){var o=n.length,i=o,a=!r;if(null==t)return!i;for(t=sl(t);o--;){var s=n[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<i;){s=n[o];var u=s[0],c=t[u],l=s[1];if(a&&s[2]){if(c===rt&&!(u in t))return!1}else{var f=new On;if(r)var p=r(c,l,u,t,e,f);if(!(p===rt?Tr(l,c,dt|ht,r,f):p))return!1}}return!0}function kr(t){return!(!ou(t)||Gi(t))&&(eu(t)?wl:Ve).test(ta(t))}function Ir(t){return iu(t)&&br(t)==Qt}function Br(t){return iu(t)&&jf(t)==te}function Mr(t){return iu(t)&&ru(t.length)&&!!wn[br(t)]}function Lr(t){return"function"==typeof t?t:null==t?Cc:"object"==typeof t?vp(t)?Wr(t[0],t[1]):Ur(t):Dc(t)}function Dr(t){if(!zi(t))return Hl(t);var e=[];for(var n in sl(t))gl.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Fr(t){if(!ou(t))return Vi(t);var e=zi(t),n=[];for(var r in t)("constructor"!=r||!e&&gl.call(t,r))&&n.push(r);return n}function Gr(t,e){return t<e}function zr(t,e){var n=-1,r=qs(t)?nl(t.length):[];return mf(t,function(t,o,i){r[++n]=e(t,o,i)}),r}function Ur(t){var e=Oi(t);return 1==e.length&&e[0][2]?Wi(e[0][0],e[0][1]):function(n){return n===t||Nr(n,t,e)}}function Wr(t,e){return Li(t)&&Ui(e)?Wi(Qi(t),e):function(n){var r=Lu(n,t);return r===rt&&r===e?Fu(n,t):Tr(e,r,dt|ht)}}function Hr(t,e,n,r,o){t!==e&&vf(e,function(i,a){if(ou(i))o||(o=new On),Vr(t,e,a,n,Hr,r,o);else{var s=r?r(t[a],i,a+"",t,e,o):rt;s===rt&&(s=i),Hn(t,a,s)}},zu)}function Vr(t,e,n,r,o,i,a){var s=t[n],u=e[n],c=a.get(u);if(c)return void Hn(t,n,c);var l=i?i(s,u,n+"",t,e,a):rt,f=l===rt;if(f){var p=vp(u),d=!p&&yp(u),h=!p&&!d&&Op(u);l=u,p||d||h?vp(s)?l=s:Ks(s)?l=Do(s):d?(f=!1,l=Eo(u,!0)):h?(f=!1,l=ko(u,!0)):l=[]:du(u)||gp(u)?(l=s,gp(s)?l=Au(s):(!ou(s)||r&&eu(s))&&(l=Ri(u))):f=!1}f&&(a.set(u,l),o(l,u,r,i,a),a.delete(u)),Hn(t,n,l)}function qr(t,e){var n=t.length;if(n)return e+=e<0?n:0,Bi(e,n)?t[e]:rt}function Kr(t,e,n){var r=-1;return e=h(e.length?e:[Cc],I(wi())),C(zr(t,function(t,n,o){return{criteria:h(e,function(e){return e(t)}),index:++r,value:t}}),function(t,e){return Bo(t,e,n)})}function Yr(t,e){return $r(t,e,function(e,n){return Fu(t,n)})}function $r(t,e,n){for(var r=-1,o=e.length,i={};++r<o;){var a=e[r],s=gr(t,a);n(s,a)&&io(i,Oo(a,t),s)}return i}function Zr(t){return function(e){return gr(e,t)}}function Xr(t,e,n,r){var o=r?O:S,i=-1,a=e.length,s=t;for(t===e&&(e=Do(e)),n&&(s=h(t,I(n)));++i<a;)for(var u=0,c=e[i],l=n?n(c):c;(u=o(s,l,u,r))>-1;)s!==t&&Cl.call(s,u,1),Cl.call(t,u,1);return t}function Jr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var o=e[n];if(n==r||o!==i){var i=o;Bi(o)?Cl.call(t,o,1):go(t,o)}}return t}function Qr(t,e){return t+Fl($l()*(e-t+1))}function to(t,e,n,r){for(var o=-1,i=Vl(Dl((e-t)/(n||1)),0),a=nl(i);i--;)a[r?i:++o]=t,t+=n;return a}function eo(t,e){var n="";if(!t||e<1||e>Nt)return n;do{e%2&&(n+=t),(e=Fl(e/2))&&(t+=t)}while(e);return n}function no(t,e){return Rf(Ki(t,e,Cc),t+"")}function ro(t){return In(Qu(t))}function oo(t,e){var n=Qu(t);return Ji(n,nr(e,0,n.length))}function io(t,e,n,r){if(!ou(t))return t;e=Oo(e,t);for(var o=-1,i=e.length,a=i-1,s=t;null!=s&&++o<i;){var u=Qi(e[o]),c=n;if(o!=a){var l=s[u];c=r?r(l,u,s):rt,c===rt&&(c=ou(l)?l:Bi(e[o+1])?[]:{})}$n(s,u,c),s=s[u]}return t}function ao(t){return Ji(Qu(t))}function so(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),n=n>o?o:n,n<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=nl(o);++r<o;)i[r]=t[r+e];return i}function uo(t,e){var n;return mf(t,function(t,r,o){return!(n=e(t,r,o))}),!!n}function co(t,e,n){var r=0,o=null==t?r:t.length;if("number"==typeof e&&e===e&&o<=Lt){for(;r<o;){var i=r+o>>>1,a=t[i];null!==a&&!gu(a)&&(n?a<=e:a<e)?r=i+1:o=i}return o}return lo(t,e,Cc,n)}function lo(t,e,n,r){e=n(e);for(var o=0,i=null==t?0:t.length,a=e!==e,s=null===e,u=gu(e),c=e===rt;o<i;){var l=Fl((o+i)/2),f=n(t[l]),p=f!==rt,d=null===f,h=f===f,m=gu(f);if(a)var g=r||h;else g=c?h&&(r||p):s?h&&p&&(r||!d):u?h&&p&&!d&&(r||!m):!d&&!m&&(r?f<=e:f<e);g?o=l+1:i=l}return ql(i,Mt)}function fo(t,e){for(var n=-1,r=t.length,o=0,i=[];++n<r;){var a=t[n],s=e?e(a):a;if(!n||!Vs(s,u)){var u=s;i[o++]=0===a?0:a}}return i}function po(t){return"number"==typeof t?t:gu(t)?It:+t}function ho(t){if("string"==typeof t)return t;if(vp(t))return h(t,ho)+"";if(gu(t))return df?df.call(t):"";var e=t+"";return"0"==e&&1/t==-Rt?"-0":e}function mo(t,e,n){var r=-1,o=p,i=t.length,a=!0,s=[],u=s;if(n)a=!1,o=d;else if(i>=ot){var c=e?null:Sf(t);if(c)return Y(c);a=!1,o=M,u=new vn}else u=e?[]:s;t:for(;++r<i;){var l=t[r],f=e?e(l):l;if(l=n||0!==l?l:0,a&&f===f){for(var h=u.length;h--;)if(u[h]===f)continue t;e&&u.push(f),s.push(l)}else o(u,f,n)||(u!==s&&u.push(f),s.push(l))}return s}function go(t,e){return e=Oo(e,t),null==(t=Yi(t,e))||delete t[Qi(xa(e))]}function vo(t,e,n,r){return io(t,e,n(gr(t,e)),r)}function bo(t,e,n,r){for(var o=t.length,i=r?o:-1;(r?i--:++i<o)&&e(t[i],i,t););return n?so(t,r?0:i,r?i+1:o):so(t,r?i+1:0,r?o:i)}function yo(t,e){var n=t;return n instanceof P&&(n=n.value()),g(e,function(t,e){return e.func.apply(e.thisArg,m([t],e.args))},n)}function _o(t,e,n){var r=t.length;if(r<2)return r?mo(t[0]):[];for(var o=-1,i=nl(r);++o<r;)for(var a=t[o],s=-1;++s<r;)s!=o&&(i[o]=sr(i[o]||a,t[s],e,n));return mo(pr(i,1),e,n)}function xo(t,e,n){for(var r=-1,o=t.length,i=e.length,a={};++r<o;){var s=r<i?e[r]:rt;n(a,t[r],s)}return a}function wo(t){return Ks(t)?t:[]}function So(t){return"function"==typeof t?t:Cc}function Oo(t,e){return vp(t)?t:Li(t,e)?[t]:Nf(ju(t))}function Ao(t,e,n){var r=t.length;return n=n===rt?r:n,!e&&n>=r?t:so(t,e,n)}function Eo(t,e){if(e)return t.slice();var n=t.length,r=El?El(n):new t.constructor(n);return t.copy(r),r}function jo(t){var e=new t.constructor(t.byteLength);return new Al(e).set(new Al(t)),e}function Po(t,e){var n=e?jo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}function To(t,e,n){return g(e?n(V(t),lt):V(t),o,new t.constructor)}function Co(t){var e=new t.constructor(t.source,Ue.exec(t));return e.lastIndex=t.lastIndex,e}function Ro(t,e,n){return g(e?n(Y(t),lt):Y(t),i,new t.constructor)}function No(t){return pf?sl(pf.call(t)):{}}function ko(t,e){var n=e?jo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Io(t,e){if(t!==e){var n=t!==rt,r=null===t,o=t===t,i=gu(t),a=e!==rt,s=null===e,u=e===e,c=gu(e);if(!s&&!c&&!i&&t>e||i&&a&&u&&!s&&!c||r&&a&&u||!n&&u||!o)return 1;if(!r&&!i&&!c&&t<e||c&&n&&o&&!r&&!i||s&&n&&o||!a&&o||!u)return-1}return 0}function Bo(t,e,n){for(var r=-1,o=t.criteria,i=e.criteria,a=o.length,s=n.length;++r<a;){var u=Io(o[r],i[r]);if(u){if(r>=s)return u;return u*("desc"==n[r]?-1:1)}}return t.index-e.index}function Mo(t,e,n,r){for(var o=-1,i=t.length,a=n.length,s=-1,u=e.length,c=Vl(i-a,0),l=nl(u+c),f=!r;++s<u;)l[s]=e[s];for(;++o<a;)(f||o<i)&&(l[n[o]]=t[o]);for(;c--;)l[s++]=t[o++];return l}function Lo(t,e,n,r){for(var o=-1,i=t.length,a=-1,s=n.length,u=-1,c=e.length,l=Vl(i-s,0),f=nl(l+c),p=!r;++o<l;)f[o]=t[o];for(var d=o;++u<c;)f[d+u]=e[u];for(;++a<s;)(p||o<i)&&(f[d+n[a]]=t[o++]);return f}function Do(t,e){var n=-1,r=t.length;for(e||(e=nl(r));++n<r;)e[n]=t[n];return e}function Fo(t,e,n,r){var o=!n;n||(n={});for(var i=-1,a=e.length;++i<a;){var s=e[i],u=r?r(n[s],t[s],s,n,t):rt;u===rt&&(u=t[s]),o?tr(n,s,u):$n(n,s,u)}return n}function Go(t,e){return Fo(t,Af(t),e)}function zo(t,e){return Fo(t,Ef(t),e)}function Uo(t,e){return function(n,r){var o=vp(n)?s:Xn,i=e?e():{};return o(n,t,wi(r,2),i)}}function Wo(t){return no(function(e,n){var r=-1,o=n.length,i=o>1?n[o-1]:rt,a=o>2?n[2]:rt;for(i=t.length>3&&"function"==typeof i?(o--,i):rt,a&&Mi(n[0],n[1],a)&&(i=o<3?rt:i,o=1),e=sl(e);++r<o;){var s=n[r];s&&t(e,s,r,i)}return e})}function Ho(t,e){return function(n,r){if(null==n)return n;if(!qs(n))return t(n,r);for(var o=n.length,i=e?o:-1,a=sl(n);(e?i--:++i<o)&&!1!==r(a[i],i,a););return n}}function Vo(t){return function(e,n,r){for(var o=-1,i=sl(e),a=r(e),s=a.length;s--;){var u=a[t?s:++o];if(!1===n(i[u],u,i))break}return e}}function qo(t,e,n){function r(){return(this&&this!==Nn&&this instanceof r?i:t).apply(o?n:this,arguments)}var o=e&mt,i=$o(t);return r}function Ko(t){return function(e){e=ju(e);var n=U(e)?Q(e):rt,r=n?n[0]:e.charAt(0),o=n?Ao(n,1).join(""):e.slice(1);return r[t]()+o}}function Yo(t){return function(e){return g(Ac(ic(e).replace(hn,"")),t,"")}}function $o(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=hf(t.prototype),r=t.apply(n,e);return ou(r)?r:n}}function Zo(t,e,n){function r(){for(var i=arguments.length,s=nl(i),u=i,c=xi(r);u--;)s[u]=arguments[u];var l=i<3&&s[0]!==c&&s[i-1]!==c?[]:K(s,c);return(i-=l.length)<n?si(t,e,Qo,r.placeholder,rt,s,l,rt,rt,n-i):a(this&&this!==Nn&&this instanceof r?o:t,this,s)}var o=$o(t);return r}function Xo(t){return function(e,n,r){var o=sl(e);if(!qs(e)){var i=wi(n,3);e=Gu(e),n=function(t){return i(o[t],t,o)}}var a=t(e,n,r);return a>-1?o[i?e[a]:a]:rt}}function Jo(t){return vi(function(e){var n=e.length,r=n,o=y.prototype.thru;for(t&&e.reverse();r--;){var i=e[r];if("function"!=typeof i)throw new ll(at);if(o&&!a&&"wrapper"==_i(i))var a=new y([],!0)}for(r=a?r:n;++r<n;){i=e[r];var s=_i(i),u="wrapper"==s?Of(i):rt;a=u&&Fi(u[0])&&u[1]==(wt|bt|_t|St)&&!u[4].length&&1==u[9]?a[_i(u[0])].apply(a,u[3]):1==i.length&&Fi(i)?a[s]():a.thru(i)}return function(){var t=arguments,r=t[0];if(a&&1==t.length&&vp(r))return a.plant(r).value();for(var o=0,i=n?e[o].apply(this,t):r;++o<n;)i=e[o].call(this,i);return i}})}function Qo(t,e,n,r,o,i,a,s,u,c){function l(){for(var v=arguments.length,b=nl(v),y=v;y--;)b[y]=arguments[y];if(h)var _=xi(l),x=F(b,_);if(r&&(b=Mo(b,r,o,h)),i&&(b=Lo(b,i,a,h)),v-=x,h&&v<c){var w=K(b,_);return si(t,e,Qo,l.placeholder,n,b,w,s,u,c-v)}var S=p?n:this,O=d?S[t]:t;return v=b.length,s?b=$i(b,s):m&&v>1&&b.reverse(),f&&u<v&&(b.length=u),this&&this!==Nn&&this instanceof l&&(O=g||$o(O)),O.apply(S,b)}var f=e&wt,p=e&mt,d=e&gt,h=e&(bt|yt),m=e&Ot,g=d?rt:$o(t);return l}function ti(t,e){return function(n,r){return Or(n,t,e(r),{})}}function ei(t,e){return function(n,r){var o;if(n===rt&&r===rt)return e;if(n!==rt&&(o=n),r!==rt){if(o===rt)return r;"string"==typeof n||"string"==typeof r?(n=ho(n),r=ho(r)):(n=po(n),r=po(r)),o=t(n,r)}return o}}function ni(t){return vi(function(e){return e=h(e,I(wi())),no(function(n){var r=this;return t(e,function(t){return a(t,r,n)})})})}function ri(t,e){e=e===rt?" ":ho(e);var n=e.length;if(n<2)return n?eo(e,t):e;var r=eo(e,Dl(t/J(e)));return U(e)?Ao(Q(r),0,t).join(""):r.slice(0,t)}function oi(t,e,n,r){function o(){for(var e=-1,u=arguments.length,c=-1,l=r.length,f=nl(l+u),p=this&&this!==Nn&&this instanceof o?s:t;++c<l;)f[c]=r[c];for(;u--;)f[c++]=arguments[++e];return a(p,i?n:this,f)}var i=e&mt,s=$o(t);return o}function ii(t){return function(e,n,r){return r&&"number"!=typeof r&&Mi(e,n,r)&&(n=r=rt),e=xu(e),n===rt?(n=e,e=0):n=xu(n),r=r===rt?e<n?1:-1:xu(r),to(e,n,r,t)}}function ai(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=Ou(e),n=Ou(n)),t(e,n)}}function si(t,e,n,r,o,i,a,s,u,c){var l=e&bt,f=l?a:rt,p=l?rt:a,d=l?i:rt,h=l?rt:i;e|=l?_t:xt,(e&=~(l?xt:_t))&vt||(e&=~(mt|gt));var m=[t,e,o,d,f,h,p,s,u,c],g=n.apply(rt,m);return Fi(t)&&Tf(g,m),g.placeholder=r,Zi(g,t,e)}function ui(t){var e=al[t];return function(t,n){if(t=Ou(t),n=null==n?0:ql(wu(n),292)){var r=(ju(t)+"e").split("e");return r=(ju(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"),+(r[0]+"e"+(+r[1]-n))}return e(t)}}function ci(t){return function(e){var n=jf(e);return n==Yt?V(e):n==te?$(e):k(e,t(e))}}function li(t,e,n,r,o,i,a,s){var u=e&gt;if(!u&&"function"!=typeof t)throw new ll(at);var c=r?r.length:0;if(c||(e&=~(_t|xt),r=o=rt),a=a===rt?a:Vl(wu(a),0),s=s===rt?s:wu(s),c-=o?o.length:0,e&xt){var l=r,f=o;r=o=rt}var p=u?rt:Of(t),d=[t,e,n,r,o,l,f,i,a,s];if(p&&Hi(d,p),t=d[0],e=d[1],n=d[2],r=d[3],o=d[4],s=d[9]=d[9]===rt?u?0:t.length:Vl(d[9]-c,0),!s&&e&(bt|yt)&&(e&=~(bt|yt)),e&&e!=mt)h=e==bt||e==yt?Zo(t,e,s):e!=_t&&e!=(mt|_t)||o.length?Qo.apply(rt,d):oi(t,e,n,r);else var h=qo(t,e,n);return Zi((p?yf:Tf)(h,d),t,e)}function fi(t,e,n,r){return t===rt||Vs(t,dl[n])&&!gl.call(r,n)?e:t}function pi(t,e,n,r,o,i){return ou(t)&&ou(e)&&(i.set(e,t),Hr(t,e,rt,pi,i),i.delete(e)),t}function di(t){return du(t)?rt:t}function hi(t,e,n,r,o,i){var a=n&dt,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=i.get(t);if(c&&i.get(e))return c==e;var l=-1,f=!0,p=n&ht?new vn:rt;for(i.set(t,e),i.set(e,t);++l<s;){var d=t[l],h=e[l];if(r)var m=a?r(h,d,l,e,t,i):r(d,h,l,t,e,i);if(m!==rt){if(m)continue;f=!1;break}if(p){if(!b(e,function(t,e){if(!M(p,e)&&(d===t||o(d,t,n,r,i)))return p.push(e)})){f=!1;break}}else if(d!==h&&!o(d,h,n,r,i)){f=!1;break}}return i.delete(t),i.delete(e),f}function mi(t,e,n,r,o,i,a){switch(n){case se:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case ae:return!(t.byteLength!=e.byteLength||!i(new Al(t),new Al(e)));case Ut:case Wt:case $t:return Vs(+t,+e);case Vt:return t.name==e.name&&t.message==e.message;case Qt:case ee:return t==e+"";case Yt:var s=V;case te:var u=r&dt;if(s||(s=Y),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=ht,a.set(t,e);var l=hi(s(t),s(e),r,o,i,a);return a.delete(t),l;case ne:if(pf)return pf.call(t)==pf.call(e)}return!1}function gi(t,e,n,r,o,i){var a=n&dt,s=bi(t),u=s.length;if(u!=bi(e).length&&!a)return!1;for(var c=u;c--;){var l=s[c];if(!(a?l in e:gl.call(e,l)))return!1}var f=i.get(t);if(f&&i.get(e))return f==e;var p=!0;i.set(t,e),i.set(e,t);for(var d=a;++c<u;){l=s[c];var h=t[l],m=e[l];if(r)var g=a?r(m,h,l,e,t,i):r(h,m,l,t,e,i);if(!(g===rt?h===m||o(h,m,n,r,i):g)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var v=t.constructor,b=e.constructor;v!=b&&"constructor"in t&&"constructor"in e&&!("function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b)&&(p=!1)}return i.delete(t),i.delete(e),p}function vi(t){return Rf(Ki(t,rt,da),t+"")}function bi(t){return vr(t,Gu,Af)}function yi(t){return vr(t,zu,Ef)}function _i(t){for(var e=t.name+"",n=of[e],r=gl.call(of,e)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==t)return o.name}return e}function xi(t){return(gl.call(n,"placeholder")?n:t).placeholder}function wi(){var t=n.iteratee||Rc;return t=t===Rc?Lr:t,arguments.length?t(arguments[0],arguments[1]):t}function Si(t,e){var n=t.__data__;return Di(e)?n["string"==typeof e?"string":"hash"]:n.map}function Oi(t){for(var e=Gu(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Ui(o)]}return e}function Ai(t,e){var n=z(t,e);return kr(n)?n:rt}function Ei(t){var e=gl.call(t,kl),n=t[kl];try{t[kl]=rt;var r=!0}catch(t){}var o=yl.call(t);return r&&(e?t[kl]=n:delete t[kl]),o}function ji(t,e,n){for(var r=-1,o=n.length;++r<o;){var i=n[r],a=i.size;switch(i.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=ql(e,t+a);break;case"takeRight":t=Vl(t,e-a)}}return{start:t,end:e}}function Pi(t){var e=t.match(Le);return e?e[1].split(De):[]}function Ti(t,e,n){e=Oo(e,t);for(var r=-1,o=e.length,i=!1;++r<o;){var a=Qi(e[r]);if(!(i=null!=t&&n(t,a)))break;t=t[a]}return i||++r!=o?i:!!(o=null==t?0:t.length)&&ru(o)&&Bi(a,o)&&(vp(t)||gp(t))}function Ci(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&gl.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function Ri(t){return"function"!=typeof t.constructor||zi(t)?{}:hf(jl(t))}function Ni(t,e,n,r){var o=t.constructor;switch(e){case ae:return jo(t);case Ut:case Wt:return new o(+t);case se:return Po(t,r);case ue:case ce:case le:case fe:case pe:case de:case he:case me:case ge:return ko(t,r);case Yt:return To(t,r,n);case $t:case ee:return new o(t);case Qt:return Co(t);case te:return Ro(t,r,n);case ne:return No(t)}}function ki(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Me,"{\n/* [wrapped with "+e+"] */\n")}function Ii(t){return vp(t)||gp(t)||!!(Rl&&t&&t[Rl])}function Bi(t,e){return!!(e=null==e?Nt:e)&&("number"==typeof t||Ke.test(t))&&t>-1&&t%1==0&&t<e}function Mi(t,e,n){if(!ou(n))return!1;var r=typeof e;return!!("number"==r?qs(n)&&Bi(e,n.length):"string"==r&&e in n)&&Vs(n[e],t)}function Li(t,e){if(vp(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!gu(t))||(Pe.test(t)||!je.test(t)||null!=e&&t in sl(e))}function Di(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function Fi(t){var e=_i(t),r=n[e];if("function"!=typeof r||!(e in P.prototype))return!1;if(t===r)return!0;var o=Of(r);return!!o&&t===o[0]}function Gi(t){return!!bl&&bl in t}function zi(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||dl)}function Ui(t){return t===t&&!ou(t)}function Wi(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==rt||t in sl(n)))}}function Hi(t,e){var n=t[1],r=e[1],o=n|r,i=o<(mt|gt|wt),a=r==wt&&n==bt||r==wt&&n==St&&t[7].length<=e[8]||r==(wt|St)&&e[7].length<=e[8]&&n==bt;if(!i&&!a)return t;r&mt&&(t[2]=e[2],o|=n&mt?0:vt);var s=e[3];if(s){var u=t[3];t[3]=u?Mo(u,s,e[4]):s,t[4]=u?K(t[3],ct):e[4]}return s=e[5],s&&(u=t[5],t[5]=u?Lo(u,s,e[6]):s,t[6]=u?K(t[5],ct):e[6]),s=e[7],s&&(t[7]=s),r&wt&&(t[8]=null==t[8]?e[8]:ql(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=o,t}function Vi(t){var e=[];if(null!=t)for(var n in sl(t))e.push(n);return e}function qi(t){return yl.call(t)}function Ki(t,e,n){return e=Vl(e===rt?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Vl(r.length-e,0),s=nl(i);++o<i;)s[o]=r[e+o];o=-1;for(var u=nl(e+1);++o<e;)u[o]=r[o];return u[e]=n(s),a(t,this,u)}}function Yi(t,e){return e.length<2?t:gr(t,so(e,0,-1))}function $i(t,e){for(var n=t.length,r=ql(e.length,n),o=Do(t);r--;){var i=e[r];t[r]=Bi(i,n)?o[i]:rt}return t}function Zi(t,e,n){var r=e+"";return Rf(t,ki(r,ea(Pi(r),n)))}function Xi(t){var e=0,n=0;return function(){var r=Kl(),o=Pt-(r-n);if(n=r,o>0){if(++e>=jt)return arguments[0]}else e=0;return t.apply(rt,arguments)}}function Ji(t,e){var n=-1,r=t.length,o=r-1;for(e=e===rt?r:e;++n<e;){var i=Qr(n,o),a=t[i];t[i]=t[n],t[n]=a}return t.length=e,t}function Qi(t){if("string"==typeof t||gu(t))return t;var e=t+"";return"0"==e&&1/t==-Rt?"-0":e}function ta(t){if(null!=t){try{return ml.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function ea(t,e){return u(Dt,function(n){var r="_."+n[0];e&n[1]&&!p(t,r)&&t.push(r)}),t.sort()}function na(t){if(t instanceof P)return t.clone();var e=new y(t.__wrapped__,t.__chain__);return e.__actions__=Do(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}function ra(t,e,n){e=(n?Mi(t,e,n):e===rt)?1:Vl(wu(e),0);var r=null==t?0:t.length;if(!r||e<1)return[];for(var o=0,i=0,a=nl(Dl(r/e));o<r;)a[i++]=so(t,o,o+=e);return a}function oa(t){for(var e=-1,n=null==t?0:t.length,r=0,o=[];++e<n;){var i=t[e];i&&(o[r++]=i)}return o}function ia(){var t=arguments.length;if(!t)return[];for(var e=nl(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return m(vp(n)?Do(n):[n],pr(e,1))}function aa(t,e,n){var r=null==t?0:t.length;return r?(e=n||e===rt?1:wu(e),so(t,e<0?0:e,r)):[]}function sa(t,e,n){var r=null==t?0:t.length;return r?(e=n||e===rt?1:wu(e),e=r-e,so(t,0,e<0?0:e)):[]}function ua(t,e){return t&&t.length?bo(t,wi(e,3),!0,!0):[]}function ca(t,e){return t&&t.length?bo(t,wi(e,3),!0):[]}function la(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&Mi(t,e,n)&&(n=0,r=o),lr(t,e,n,r)):[]}function fa(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=null==n?0:wu(n);return o<0&&(o=Vl(r+o,0)),w(t,wi(e,3),o)}function pa(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==rt&&(o=wu(n),o=n<0?Vl(r+o,0):ql(o,r-1)),w(t,wi(e,3),o,!0)}function da(t){return(null==t?0:t.length)?pr(t,1):[]}function ha(t){return(null==t?0:t.length)?pr(t,Rt):[]}function ma(t,e){return(null==t?0:t.length)?(e=e===rt?1:wu(e),pr(t,e)):[]}function ga(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var o=t[e];r[o[0]]=o[1]}return r}function va(t){return t&&t.length?t[0]:rt}function ba(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=null==n?0:wu(n);return o<0&&(o=Vl(r+o,0)),S(t,e,o)}function ya(t){return(null==t?0:t.length)?so(t,0,-1):[]}function _a(t,e){return null==t?"":Wl.call(t,e)}function xa(t){var e=null==t?0:t.length;return e?t[e-1]:rt}function wa(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==rt&&(o=wu(n),o=o<0?Vl(r+o,0):ql(o,r-1)),e===e?X(t,e,o):w(t,A,o,!0)}function Sa(t,e){return t&&t.length?qr(t,wu(e)):rt}function Oa(t,e){return t&&t.length&&e&&e.length?Xr(t,e):t}function Aa(t,e,n){return t&&t.length&&e&&e.length?Xr(t,e,wi(n,2)):t}function Ea(t,e,n){return t&&t.length&&e&&e.length?Xr(t,e,rt,n):t}function ja(t,e){var n=[];if(!t||!t.length)return n;var r=-1,o=[],i=t.length;for(e=wi(e,3);++r<i;){var a=t[r];e(a,r,t)&&(n.push(a),o.push(r))}return Jr(t,o),n}function Pa(t){return null==t?t:Zl.call(t)}function Ta(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&Mi(t,e,n)?(e=0,n=r):(e=null==e?0:wu(e),n=n===rt?r:wu(n)),so(t,e,n)):[]}function Ca(t,e){return co(t,e)}function Ra(t,e,n){return lo(t,e,wi(n,2))}function Na(t,e){var n=null==t?0:t.length;if(n){var r=co(t,e);if(r<n&&Vs(t[r],e))return r}return-1}function ka(t,e){return co(t,e,!0)}function Ia(t,e,n){return lo(t,e,wi(n,2),!0)}function Ba(t,e){if(null==t?0:t.length){var n=co(t,e,!0)-1;if(Vs(t[n],e))return n}return-1}function Ma(t){return t&&t.length?fo(t):[]}function La(t,e){return t&&t.length?fo(t,wi(e,2)):[]}function Da(t){var e=null==t?0:t.length;return e?so(t,1,e):[]}function Fa(t,e,n){return t&&t.length?(e=n||e===rt?1:wu(e),so(t,0,e<0?0:e)):[]}function Ga(t,e,n){var r=null==t?0:t.length;return r?(e=n||e===rt?1:wu(e),e=r-e,so(t,e<0?0:e,r)):[]}function za(t,e){return t&&t.length?bo(t,wi(e,3),!1,!0):[]}function Ua(t,e){return t&&t.length?bo(t,wi(e,3)):[]}function Wa(t){return t&&t.length?mo(t):[]}function Ha(t,e){return t&&t.length?mo(t,wi(e,2)):[]}function Va(t,e){return e="function"==typeof e?e:rt,t&&t.length?mo(t,rt,e):[]}function qa(t){if(!t||!t.length)return[];var e=0;return t=f(t,function(t){if(Ks(t))return e=Vl(t.length,e),!0}),N(e,function(e){return h(t,j(e))})}function Ka(t,e){if(!t||!t.length)return[];var n=qa(t);return null==e?n:h(n,function(t){return a(e,rt,t)})}function Ya(t,e){return xo(t||[],e||[],$n)}function $a(t,e){return xo(t||[],e||[],io)}function Za(t){var e=n(t);return e.__chain__=!0,e}function Xa(t,e){return e(t),t}function Ja(t,e){return e(t)}function Qa(){return Za(this)}function ts(){return new y(this.value(),this.__chain__)}function es(){this.__values__===rt&&(this.__values__=_u(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?rt:this.__values__[this.__index__++]}}function ns(){return this}function rs(t){for(var e,n=this;n instanceof r;){var o=na(n);o.__index__=0,o.__values__=rt,e?i.__wrapped__=o:e=o;var i=o;n=n.__wrapped__}return i.__wrapped__=t,e}function os(){var t=this.__wrapped__;if(t instanceof P){var e=t;return this.__actions__.length&&(e=new P(this)),e=e.reverse(),e.__actions__.push({func:Ja,args:[Pa],thisArg:rt}),new y(e,this.__chain__)}return this.thru(Pa)}function is(){return yo(this.__wrapped__,this.__actions__)}function as(t,e,n){var r=vp(t)?l:ur;return n&&Mi(t,e,n)&&(e=rt),r(t,wi(e,3))}function ss(t,e){return(vp(t)?f:fr)(t,wi(e,3))}function us(t,e){return pr(hs(t,e),1)}function cs(t,e){return pr(hs(t,e),Rt)}function ls(t,e,n){return n=n===rt?1:wu(n),pr(hs(t,e),n)}function fs(t,e){return(vp(t)?u:mf)(t,wi(e,3))}function ps(t,e){return(vp(t)?c:gf)(t,wi(e,3))}function ds(t,e,n,r){t=qs(t)?t:Qu(t),n=n&&!r?wu(n):0;var o=t.length;return n<0&&(n=Vl(o+n,0)),mu(t)?n<=o&&t.indexOf(e,n)>-1:!!o&&S(t,e,n)>-1}function hs(t,e){return(vp(t)?h:zr)(t,wi(e,3))}function ms(t,e,n,r){return null==t?[]:(vp(e)||(e=null==e?[]:[e]),n=r?rt:n,vp(n)||(n=null==n?[]:[n]),Kr(t,e,n))}function gs(t,e,n){var r=vp(t)?g:T,o=arguments.length<3;return r(t,wi(e,4),n,o,mf)}function vs(t,e,n){var r=vp(t)?v:T,o=arguments.length<3;return r(t,wi(e,4),n,o,gf)}function bs(t,e){return(vp(t)?f:fr)(t,Ns(wi(e,3)))}function ys(t){return(vp(t)?In:ro)(t)}function _s(t,e,n){return e=(n?Mi(t,e,n):e===rt)?1:wu(e),(vp(t)?Mn:oo)(t,e)}function xs(t){return(vp(t)?Ln:ao)(t)}function ws(t){if(null==t)return 0;if(qs(t))return mu(t)?J(t):t.length;var e=jf(t);return e==Yt||e==te?t.size:Dr(t).length}function Ss(t,e,n){var r=vp(t)?b:uo;return n&&Mi(t,e,n)&&(e=rt),r(t,wi(e,3))}function Os(t,e){if("function"!=typeof e)throw new ll(at);return t=wu(t),function(){if(--t<1)return e.apply(this,arguments)}}function As(t,e,n){return e=n?rt:e,e=t&&null==e?t.length:e,li(t,wt,rt,rt,rt,rt,e)}function Es(t,e){var n;if("function"!=typeof e)throw new ll(at);return t=wu(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=rt),n}}function js(t,e,n){e=n?rt:e;var r=li(t,bt,rt,rt,rt,rt,rt,e);return r.placeholder=js.placeholder,r}function Ps(t,e,n){e=n?rt:e;var r=li(t,yt,rt,rt,rt,rt,rt,e);return r.placeholder=Ps.placeholder,r}function Ts(t,e,n){function r(e){var n=p,r=d;return p=d=rt,b=e,m=t.apply(r,n)}
function o(t){return b=t,g=Cf(s,e),y?r(t):m}function i(t){var n=t-v,r=t-b,o=e-n;return _?ql(o,h-r):o}function a(t){var n=t-v,r=t-b;return v===rt||n>=e||n<0||_&&r>=h}function s(){var t=ip();if(a(t))return u(t);g=Cf(s,i(t))}function u(t){return g=rt,x&&p?r(t):(p=d=rt,m)}function c(){g!==rt&&wf(g),b=0,p=v=d=g=rt}function l(){return g===rt?m:u(ip())}function f(){var t=ip(),n=a(t);if(p=arguments,d=this,v=t,n){if(g===rt)return o(v);if(_)return g=Cf(s,e),r(v)}return g===rt&&(g=Cf(s,e)),m}var p,d,h,m,g,v,b=0,y=!1,_=!1,x=!0;if("function"!=typeof t)throw new ll(at);return e=Ou(e)||0,ou(n)&&(y=!!n.leading,_="maxWait"in n,h=_?Vl(Ou(n.maxWait)||0,e):h,x="trailing"in n?!!n.trailing:x),f.cancel=c,f.flush=l,f}function Cs(t){return li(t,Ot)}function Rs(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new ll(at);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(Rs.Cache||cn),n}function Ns(t){if("function"!=typeof t)throw new ll(at);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function ks(t){return Es(2,t)}function Is(t,e){if("function"!=typeof t)throw new ll(at);return e=e===rt?e:wu(e),no(t,e)}function Bs(t,e){if("function"!=typeof t)throw new ll(at);return e=null==e?0:Vl(wu(e),0),no(function(n){var r=n[e],o=Ao(n,0,e);return r&&m(o,r),a(t,this,o)})}function Ms(t,e,n){var r=!0,o=!0;if("function"!=typeof t)throw new ll(at);return ou(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Ts(t,e,{leading:r,maxWait:e,trailing:o})}function Ls(t){return As(t,1)}function Ds(t,e){return fp(So(e),t)}function Fs(){if(!arguments.length)return[];var t=arguments[0];return vp(t)?t:[t]}function Gs(t){return rr(t,pt)}function zs(t,e){return e="function"==typeof e?e:rt,rr(t,pt,e)}function Us(t){return rr(t,lt|pt)}function Ws(t,e){return e="function"==typeof e?e:rt,rr(t,lt|pt,e)}function Hs(t,e){return null==e||ir(t,e,Gu(e))}function Vs(t,e){return t===e||t!==t&&e!==e}function qs(t){return null!=t&&ru(t.length)&&!eu(t)}function Ks(t){return iu(t)&&qs(t)}function Ys(t){return!0===t||!1===t||iu(t)&&br(t)==Ut}function $s(t){return iu(t)&&1===t.nodeType&&!du(t)}function Zs(t){if(null==t)return!0;if(qs(t)&&(vp(t)||"string"==typeof t||"function"==typeof t.splice||yp(t)||Op(t)||gp(t)))return!t.length;var e=jf(t);if(e==Yt||e==te)return!t.size;if(zi(t))return!Dr(t).length;for(var n in t)if(gl.call(t,n))return!1;return!0}function Xs(t,e){return Tr(t,e)}function Js(t,e,n){n="function"==typeof n?n:rt;var r=n?n(t,e):rt;return r===rt?Tr(t,e,rt,n):!!r}function Qs(t){if(!iu(t))return!1;var e=br(t);return e==Vt||e==Ht||"string"==typeof t.message&&"string"==typeof t.name&&!du(t)}function tu(t){return"number"==typeof t&&Ul(t)}function eu(t){if(!ou(t))return!1;var e=br(t);return e==qt||e==Kt||e==zt||e==Jt}function nu(t){return"number"==typeof t&&t==wu(t)}function ru(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Nt}function ou(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function iu(t){return null!=t&&"object"==typeof t}function au(t,e){return t===e||Nr(t,e,Oi(e))}function su(t,e,n){return n="function"==typeof n?n:rt,Nr(t,e,Oi(e),n)}function uu(t){return pu(t)&&t!=+t}function cu(t){if(Pf(t))throw new ol(it);return kr(t)}function lu(t){return null===t}function fu(t){return null==t}function pu(t){return"number"==typeof t||iu(t)&&br(t)==$t}function du(t){if(!iu(t)||br(t)!=Xt)return!1;var e=jl(t);if(null===e)return!0;var n=gl.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ml.call(n)==_l}function hu(t){return nu(t)&&t>=-Nt&&t<=Nt}function mu(t){return"string"==typeof t||!vp(t)&&iu(t)&&br(t)==ee}function gu(t){return"symbol"==typeof t||iu(t)&&br(t)==ne}function vu(t){return t===rt}function bu(t){return iu(t)&&jf(t)==oe}function yu(t){return iu(t)&&br(t)==ie}function _u(t){if(!t)return[];if(qs(t))return mu(t)?Q(t):Do(t);if(Nl&&t[Nl])return H(t[Nl]());var e=jf(t);return(e==Yt?V:e==te?Y:Qu)(t)}function xu(t){if(!t)return 0===t?t:0;if((t=Ou(t))===Rt||t===-Rt){return(t<0?-1:1)*kt}return t===t?t:0}function wu(t){var e=xu(t),n=e%1;return e===e?n?e-n:e:0}function Su(t){return t?nr(wu(t),0,Bt):0}function Ou(t){if("number"==typeof t)return t;if(gu(t))return It;if(ou(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ou(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ke,"");var n=He.test(t);return n||qe.test(t)?Tn(t.slice(2),n?2:8):We.test(t)?It:+t}function Au(t){return Fo(t,zu(t))}function Eu(t){return t?nr(wu(t),-Nt,Nt):0===t?t:0}function ju(t){return null==t?"":ho(t)}function Pu(t,e){var n=hf(t);return null==e?n:Jn(n,e)}function Tu(t,e){return x(t,wi(e,3),dr)}function Cu(t,e){return x(t,wi(e,3),hr)}function Ru(t,e){return null==t?t:vf(t,wi(e,3),zu)}function Nu(t,e){return null==t?t:bf(t,wi(e,3),zu)}function ku(t,e){return t&&dr(t,wi(e,3))}function Iu(t,e){return t&&hr(t,wi(e,3))}function Bu(t){return null==t?[]:mr(t,Gu(t))}function Mu(t){return null==t?[]:mr(t,zu(t))}function Lu(t,e,n){var r=null==t?rt:gr(t,e);return r===rt?n:r}function Du(t,e){return null!=t&&Ti(t,e,_r)}function Fu(t,e){return null!=t&&Ti(t,e,xr)}function Gu(t){return qs(t)?kn(t):Dr(t)}function zu(t){return qs(t)?kn(t,!0):Fr(t)}function Uu(t,e){var n={};return e=wi(e,3),dr(t,function(t,r,o){tr(n,e(t,r,o),t)}),n}function Wu(t,e){var n={};return e=wi(e,3),dr(t,function(t,r,o){tr(n,r,e(t,r,o))}),n}function Hu(t,e){return Vu(t,Ns(wi(e)))}function Vu(t,e){if(null==t)return{};var n=h(yi(t),function(t){return[t]});return e=wi(e),$r(t,n,function(t,n){return e(t,n[0])})}function qu(t,e,n){e=Oo(e,t);var r=-1,o=e.length;for(o||(o=1,t=rt);++r<o;){var i=null==t?rt:t[Qi(e[r])];i===rt&&(r=o,i=n),t=eu(i)?i.call(t):i}return t}function Ku(t,e,n){return null==t?t:io(t,e,n)}function Yu(t,e,n,r){return r="function"==typeof r?r:rt,null==t?t:io(t,e,n,r)}function $u(t,e,n){var r=vp(t),o=r||yp(t)||Op(t);if(e=wi(e,4),null==n){var i=t&&t.constructor;n=o?r?new i:[]:ou(t)&&eu(i)?hf(jl(t)):{}}return(o?u:dr)(t,function(t,r,o){return e(n,t,r,o)}),n}function Zu(t,e){return null==t||go(t,e)}function Xu(t,e,n){return null==t?t:vo(t,e,So(n))}function Ju(t,e,n,r){return r="function"==typeof r?r:rt,null==t?t:vo(t,e,So(n),r)}function Qu(t){return null==t?[]:B(t,Gu(t))}function tc(t){return null==t?[]:B(t,zu(t))}function ec(t,e,n){return n===rt&&(n=e,e=rt),n!==rt&&(n=Ou(n),n=n===n?n:0),e!==rt&&(e=Ou(e),e=e===e?e:0),nr(Ou(t),e,n)}function nc(t,e,n){return e=xu(e),n===rt?(n=e,e=0):n=xu(n),t=Ou(t),wr(t,e,n)}function rc(t,e,n){if(n&&"boolean"!=typeof n&&Mi(t,e,n)&&(e=n=rt),n===rt&&("boolean"==typeof e?(n=e,e=rt):"boolean"==typeof t&&(n=t,t=rt)),t===rt&&e===rt?(t=0,e=1):(t=xu(t),e===rt?(e=t,t=0):e=xu(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=$l();return ql(t+o*(e-t+Pn("1e-"+((o+"").length-1))),e)}return Qr(t,e)}function oc(t){return Zp(ju(t).toLowerCase())}function ic(t){return(t=ju(t))&&t.replace(Ye,Vn).replace(mn,"")}function ac(t,e,n){t=ju(t),e=ho(e);var r=t.length;n=n===rt?r:nr(wu(n),0,r);var o=n;return(n-=e.length)>=0&&t.slice(n,o)==e}function sc(t){return t=ju(t),t&&Se.test(t)?t.replace(xe,qn):t}function uc(t){return t=ju(t),t&&Ne.test(t)?t.replace(Re,"\\$&"):t}function cc(t,e,n){t=ju(t),e=wu(e);var r=e?J(t):0;if(!e||r>=e)return t;var o=(e-r)/2;return ri(Fl(o),n)+t+ri(Dl(o),n)}function lc(t,e,n){t=ju(t),e=wu(e);var r=e?J(t):0;return e&&r<e?t+ri(e-r,n):t}function fc(t,e,n){t=ju(t),e=wu(e);var r=e?J(t):0;return e&&r<e?ri(e-r,n)+t:t}function pc(t,e,n){return n||null==e?e=0:e&&(e=+e),Yl(ju(t).replace(Ie,""),e||0)}function dc(t,e,n){return e=(n?Mi(t,e,n):e===rt)?1:wu(e),eo(ju(t),e)}function hc(){var t=arguments,e=ju(t[0]);return t.length<3?e:e.replace(t[1],t[2])}function mc(t,e,n){return n&&"number"!=typeof n&&Mi(t,e,n)&&(e=n=rt),(n=n===rt?Bt:n>>>0)?(t=ju(t),t&&("string"==typeof e||null!=e&&!wp(e))&&!(e=ho(e))&&U(t)?Ao(Q(t),0,n):t.split(e,n)):[]}function gc(t,e,n){return t=ju(t),n=null==n?0:nr(wu(n),0,t.length),e=ho(e),t.slice(n,n+e.length)==e}function vc(t,e,r){var o=n.templateSettings;r&&Mi(t,e,r)&&(e=rt),t=ju(t),e=Tp({},e,o,fi);var i,a,s=Tp({},e.imports,o.imports,fi),u=Gu(s),c=B(s,u),l=0,f=e.interpolate||$e,p="__p += '",d=ul((e.escape||$e).source+"|"+f.source+"|"+(f===Ee?ze:$e).source+"|"+(e.evaluate||$e).source+"|$","g"),h="//# sourceURL="+("sourceURL"in e?e.sourceURL:"lodash.templateSources["+ ++xn+"]")+"\n";t.replace(d,function(e,n,r,o,s,u){return r||(r=o),p+=t.slice(l,u).replace(Ze,G),n&&(i=!0,p+="' +\n__e("+n+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),p+="';\n";var m=e.variable;m||(p="with (obj) {\n"+p+"\n}\n"),p=(a?p.replace(ve,""):p).replace(be,"$1").replace(ye,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var g=Xp(function(){return il(u,h+"return "+p).apply(rt,c)});if(g.source=p,Qs(g))throw g;return g}function bc(t){return ju(t).toLowerCase()}function yc(t){return ju(t).toUpperCase()}function _c(t,e,n){if((t=ju(t))&&(n||e===rt))return t.replace(ke,"");if(!t||!(e=ho(e)))return t;var r=Q(t),o=Q(e);return Ao(r,L(r,o),D(r,o)+1).join("")}function xc(t,e,n){if((t=ju(t))&&(n||e===rt))return t.replace(Be,"");if(!t||!(e=ho(e)))return t;var r=Q(t);return Ao(r,0,D(r,Q(e))+1).join("")}function wc(t,e,n){if((t=ju(t))&&(n||e===rt))return t.replace(Ie,"");if(!t||!(e=ho(e)))return t;var r=Q(t);return Ao(r,L(r,Q(e))).join("")}function Sc(t,e){var n=At,r=Et;if(ou(e)){var o="separator"in e?e.separator:o;n="length"in e?wu(e.length):n,r="omission"in e?ho(e.omission):r}t=ju(t);var i=t.length;if(U(t)){var a=Q(t);i=a.length}if(n>=i)return t;var s=n-J(r);if(s<1)return r;var u=a?Ao(a,0,s).join(""):t.slice(0,s);if(o===rt)return u+r;if(a&&(s+=u.length-s),wp(o)){if(t.slice(s).search(o)){var c,l=u;for(o.global||(o=ul(o.source,ju(Ue.exec(o))+"g")),o.lastIndex=0;c=o.exec(l);)var f=c.index;u=u.slice(0,f===rt?s:f)}}else if(t.indexOf(ho(o),s)!=s){var p=u.lastIndexOf(o);p>-1&&(u=u.slice(0,p))}return u+r}function Oc(t){return t=ju(t),t&&we.test(t)?t.replace(_e,Kn):t}function Ac(t,e,n){return t=ju(t),e=n?rt:e,e===rt?W(t)?nt(t):_(t):t.match(e)||[]}function Ec(t){var e=null==t?0:t.length,n=wi();return t=e?h(t,function(t){if("function"!=typeof t[1])throw new ll(at);return[n(t[0]),t[1]]}):[],no(function(n){for(var r=-1;++r<e;){var o=t[r];if(a(o[0],this,n))return a(o[1],this,n)}})}function jc(t){return or(rr(t,lt))}function Pc(t){return function(){return t}}function Tc(t,e){return null==t||t!==t?e:t}function Cc(t){return t}function Rc(t){return Lr("function"==typeof t?t:rr(t,lt))}function Nc(t){return Ur(rr(t,lt))}function kc(t,e){return Wr(t,rr(e,lt))}function Ic(t,e,n){var r=Gu(e),o=mr(e,r);null!=n||ou(e)&&(o.length||!r.length)||(n=e,e=t,t=this,o=mr(e,Gu(e)));var i=!(ou(n)&&"chain"in n&&!n.chain),a=eu(t);return u(o,function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(i||e){var n=t(this.__wrapped__);return(n.__actions__=Do(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,m([this.value()],arguments))})}),t}function Bc(){return Nn._===this&&(Nn._=xl),this}function Mc(){}function Lc(t){return t=wu(t),no(function(e){return qr(e,t)})}function Dc(t){return Li(t)?j(Qi(t)):Zr(t)}function Fc(t){return function(e){return null==t?rt:gr(t,e)}}function Gc(){return[]}function zc(){return!1}function Uc(){return{}}function Wc(){return""}function Hc(){return!0}function Vc(t,e){if((t=wu(t))<1||t>Nt)return[];var n=Bt,r=ql(t,Bt);e=wi(e),t-=Bt;for(var o=N(r,e);++n<t;)e(n);return o}function qc(t){return vp(t)?h(t,Qi):gu(t)?[t]:Do(Nf(ju(t)))}function Kc(t){var e=++vl;return ju(t)+e}function Yc(t){return t&&t.length?cr(t,Cc,yr):rt}function $c(t,e){return t&&t.length?cr(t,wi(e,2),yr):rt}function Zc(t){return E(t,Cc)}function Xc(t,e){return E(t,wi(e,2))}function Jc(t){return t&&t.length?cr(t,Cc,Gr):rt}function Qc(t,e){return t&&t.length?cr(t,wi(e,2),Gr):rt}function tl(t){return t&&t.length?R(t,Cc):0}function el(t,e){return t&&t.length?R(t,wi(e,2)):0}e=null==e?Nn:Yn.defaults(Nn.Object(),e,Yn.pick(Nn,_n));var nl=e.Array,rl=e.Date,ol=e.Error,il=e.Function,al=e.Math,sl=e.Object,ul=e.RegExp,cl=e.String,ll=e.TypeError,fl=nl.prototype,pl=il.prototype,dl=sl.prototype,hl=e["__core-js_shared__"],ml=pl.toString,gl=dl.hasOwnProperty,vl=0,bl=function(){var t=/[^.]+$/.exec(hl&&hl.keys&&hl.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),yl=dl.toString,_l=ml.call(sl),xl=Nn._,wl=ul("^"+ml.call(gl).replace(Re,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Sl=Bn?e.Buffer:rt,Ol=e.Symbol,Al=e.Uint8Array,El=Sl?Sl.allocUnsafe:rt,jl=q(sl.getPrototypeOf,sl),Pl=sl.create,Tl=dl.propertyIsEnumerable,Cl=fl.splice,Rl=Ol?Ol.isConcatSpreadable:rt,Nl=Ol?Ol.iterator:rt,kl=Ol?Ol.toStringTag:rt,Il=function(){try{var t=Ai(sl,"defineProperty");return t({},"",{}),t}catch(t){}}(),Bl=e.clearTimeout!==Nn.clearTimeout&&e.clearTimeout,Ml=rl&&rl.now!==Nn.Date.now&&rl.now,Ll=e.setTimeout!==Nn.setTimeout&&e.setTimeout,Dl=al.ceil,Fl=al.floor,Gl=sl.getOwnPropertySymbols,zl=Sl?Sl.isBuffer:rt,Ul=e.isFinite,Wl=fl.join,Hl=q(sl.keys,sl),Vl=al.max,ql=al.min,Kl=rl.now,Yl=e.parseInt,$l=al.random,Zl=fl.reverse,Xl=Ai(e,"DataView"),Jl=Ai(e,"Map"),Ql=Ai(e,"Promise"),tf=Ai(e,"Set"),ef=Ai(e,"WeakMap"),nf=Ai(sl,"create"),rf=ef&&new ef,of={},af=ta(Xl),sf=ta(Jl),uf=ta(Ql),cf=ta(tf),lf=ta(ef),ff=Ol?Ol.prototype:rt,pf=ff?ff.valueOf:rt,df=ff?ff.toString:rt,hf=function(){function t(){}return function(e){if(!ou(e))return{};if(Pl)return Pl(e);t.prototype=e;var n=new t;return t.prototype=rt,n}}();n.templateSettings={escape:Oe,evaluate:Ae,interpolate:Ee,variable:"",imports:{_:n}},n.prototype=r.prototype,n.prototype.constructor=n,y.prototype=hf(r.prototype),y.prototype.constructor=y,P.prototype=hf(r.prototype),P.prototype.constructor=P,Fe.prototype.clear=Xe,Fe.prototype.delete=Je,Fe.prototype.get=Qe,Fe.prototype.has=tn,Fe.prototype.set=en,nn.prototype.clear=rn,nn.prototype.delete=on,nn.prototype.get=an,nn.prototype.has=sn,nn.prototype.set=un,cn.prototype.clear=ln,cn.prototype.delete=fn,cn.prototype.get=pn,cn.prototype.has=dn,cn.prototype.set=gn,vn.prototype.add=vn.prototype.push=bn,vn.prototype.has=yn,On.prototype.clear=An,On.prototype.delete=En,On.prototype.get=jn,On.prototype.has=Cn,On.prototype.set=Rn;var mf=Ho(dr),gf=Ho(hr,!0),vf=Vo(),bf=Vo(!0),yf=rf?function(t,e){return rf.set(t,e),t}:Cc,_f=Il?function(t,e){return Il(t,"toString",{configurable:!0,enumerable:!1,value:Pc(e),writable:!0})}:Cc,xf=no,wf=Bl||function(t){return Nn.clearTimeout(t)},Sf=tf&&1/Y(new tf([,-0]))[1]==Rt?function(t){return new tf(t)}:Mc,Of=rf?function(t){return rf.get(t)}:Mc,Af=Gl?function(t){return null==t?[]:(t=sl(t),f(Gl(t),function(e){return Tl.call(t,e)}))}:Gc,Ef=Gl?function(t){for(var e=[];t;)m(e,Af(t)),t=jl(t);return e}:Gc,jf=br;(Xl&&jf(new Xl(new ArrayBuffer(1)))!=se||Jl&&jf(new Jl)!=Yt||Ql&&"[object Promise]"!=jf(Ql.resolve())||tf&&jf(new tf)!=te||ef&&jf(new ef)!=oe)&&(jf=function(t){var e=br(t),n=e==Xt?t.constructor:rt,r=n?ta(n):"";if(r)switch(r){case af:return se;case sf:return Yt;case uf:return"[object Promise]";case cf:return te;case lf:return oe}return e});var Pf=hl?eu:zc,Tf=Xi(yf),Cf=Ll||function(t,e){return Nn.setTimeout(t,e)},Rf=Xi(_f),Nf=function(t){var e=Rs(t,function(t){return n.size===ut&&n.clear(),t}),n=e.cache;return e}(function(t){var e=[];return Te.test(t)&&e.push(""),t.replace(Ce,function(t,n,r,o){e.push(r?o.replace(Ge,"$1"):n||t)}),e}),kf=no(function(t,e){return Ks(t)?sr(t,pr(e,1,Ks,!0)):[]}),If=no(function(t,e){var n=xa(e);return Ks(n)&&(n=rt),Ks(t)?sr(t,pr(e,1,Ks,!0),wi(n,2)):[]}),Bf=no(function(t,e){var n=xa(e);return Ks(n)&&(n=rt),Ks(t)?sr(t,pr(e,1,Ks,!0),rt,n):[]}),Mf=no(function(t){var e=h(t,wo);return e.length&&e[0]===t[0]?Sr(e):[]}),Lf=no(function(t){var e=xa(t),n=h(t,wo);return e===xa(n)?e=rt:n.pop(),n.length&&n[0]===t[0]?Sr(n,wi(e,2)):[]}),Df=no(function(t){var e=xa(t),n=h(t,wo);return e="function"==typeof e?e:rt,e&&n.pop(),n.length&&n[0]===t[0]?Sr(n,rt,e):[]}),Ff=no(Oa),Gf=vi(function(t,e){var n=null==t?0:t.length,r=er(t,e);return Jr(t,h(e,function(t){return Bi(t,n)?+t:t}).sort(Io)),r}),zf=no(function(t){return mo(pr(t,1,Ks,!0))}),Uf=no(function(t){var e=xa(t);return Ks(e)&&(e=rt),mo(pr(t,1,Ks,!0),wi(e,2))}),Wf=no(function(t){var e=xa(t);return e="function"==typeof e?e:rt,mo(pr(t,1,Ks,!0),rt,e)}),Hf=no(function(t,e){return Ks(t)?sr(t,e):[]}),Vf=no(function(t){return _o(f(t,Ks))}),qf=no(function(t){var e=xa(t);return Ks(e)&&(e=rt),_o(f(t,Ks),wi(e,2))}),Kf=no(function(t){var e=xa(t);return e="function"==typeof e?e:rt,_o(f(t,Ks),rt,e)}),Yf=no(qa),$f=no(function(t){var e=t.length,n=e>1?t[e-1]:rt;return n="function"==typeof n?(t.pop(),n):rt,Ka(t,n)}),Zf=vi(function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return er(e,t)};return!(e>1||this.__actions__.length)&&r instanceof P&&Bi(n)?(r=r.slice(n,+n+(e?1:0)),r.__actions__.push({func:Ja,args:[o],thisArg:rt}),new y(r,this.__chain__).thru(function(t){return e&&!t.length&&t.push(rt),t})):this.thru(o)}),Xf=Uo(function(t,e,n){gl.call(t,n)?++t[n]:tr(t,n,1)}),Jf=Xo(fa),Qf=Xo(pa),tp=Uo(function(t,e,n){gl.call(t,n)?t[n].push(e):tr(t,n,[e])}),ep=no(function(t,e,n){var r=-1,o="function"==typeof e,i=qs(t)?nl(t.length):[];return mf(t,function(t){i[++r]=o?a(e,t,n):Ar(t,e,n)}),i}),np=Uo(function(t,e,n){tr(t,n,e)}),rp=Uo(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),op=no(function(t,e){if(null==t)return[];var n=e.length;return n>1&&Mi(t,e[0],e[1])?e=[]:n>2&&Mi(e[0],e[1],e[2])&&(e=[e[0]]),Kr(t,pr(e,1),[])}),ip=Ml||function(){return Nn.Date.now()},ap=no(function(t,e,n){var r=mt;if(n.length){var o=K(n,xi(ap));r|=_t}return li(t,r,e,n,o)}),sp=no(function(t,e,n){var r=mt|gt;if(n.length){var o=K(n,xi(sp));r|=_t}return li(e,r,t,n,o)}),up=no(function(t,e){return ar(t,1,e)}),cp=no(function(t,e,n){return ar(t,Ou(e)||0,n)});Rs.Cache=cn;var lp=xf(function(t,e){e=1==e.length&&vp(e[0])?h(e[0],I(wi())):h(pr(e,1),I(wi()));var n=e.length;return no(function(r){for(var o=-1,i=ql(r.length,n);++o<i;)r[o]=e[o].call(this,r[o]);return a(t,this,r)})}),fp=no(function(t,e){var n=K(e,xi(fp));return li(t,_t,rt,e,n)}),pp=no(function(t,e){var n=K(e,xi(pp));return li(t,xt,rt,e,n)}),dp=vi(function(t,e){return li(t,St,rt,rt,rt,e)}),hp=ai(yr),mp=ai(function(t,e){return t>=e}),gp=Er(function(){return arguments}())?Er:function(t){return iu(t)&&gl.call(t,"callee")&&!Tl.call(t,"callee")},vp=nl.isArray,bp=Dn?I(Dn):jr,yp=zl||zc,_p=Fn?I(Fn):Pr,xp=Gn?I(Gn):Rr,wp=zn?I(zn):Ir,Sp=Un?I(Un):Br,Op=Wn?I(Wn):Mr,Ap=ai(Gr),Ep=ai(function(t,e){return t<=e}),jp=Wo(function(t,e){if(zi(e)||qs(e))return void Fo(e,Gu(e),t);for(var n in e)gl.call(e,n)&&$n(t,n,e[n])}),Pp=Wo(function(t,e){Fo(e,zu(e),t)}),Tp=Wo(function(t,e,n,r){Fo(e,zu(e),t,r)}),Cp=Wo(function(t,e,n,r){Fo(e,Gu(e),t,r)}),Rp=vi(er),Np=no(function(t){return t.push(rt,fi),a(Tp,rt,t)}),kp=no(function(t){return t.push(rt,pi),a(Dp,rt,t)}),Ip=ti(function(t,e,n){t[e]=n},Pc(Cc)),Bp=ti(function(t,e,n){gl.call(t,e)?t[e].push(n):t[e]=[n]},wi),Mp=no(Ar),Lp=Wo(function(t,e,n){Hr(t,e,n)}),Dp=Wo(function(t,e,n,r){Hr(t,e,n,r)}),Fp=vi(function(t,e){var n={};if(null==t)return n;var r=!1;e=h(e,function(e){return e=Oo(e,t),r||(r=e.length>1),e}),Fo(t,yi(t),n),r&&(n=rr(n,lt|ft|pt,di));for(var o=e.length;o--;)go(n,e[o]);return n}),Gp=vi(function(t,e){return null==t?{}:Yr(t,e)}),zp=ci(Gu),Up=ci(zu),Wp=Yo(function(t,e,n){return e=e.toLowerCase(),t+(n?oc(e):e)}),Hp=Yo(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),Vp=Yo(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),qp=Ko("toLowerCase"),Kp=Yo(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}),Yp=Yo(function(t,e,n){return t+(n?" ":"")+Zp(e)}),$p=Yo(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Zp=Ko("toUpperCase"),Xp=no(function(t,e){try{return a(t,rt,e)}catch(t){return Qs(t)?t:new ol(t)}}),Jp=vi(function(t,e){return u(e,function(e){e=Qi(e),tr(t,e,ap(t[e],t))}),t}),Qp=Jo(),td=Jo(!0),ed=no(function(t,e){return function(n){return Ar(n,t,e)}}),nd=no(function(t,e){return function(n){return Ar(t,n,e)}}),rd=ni(h),od=ni(l),id=ni(b),ad=ii(),sd=ii(!0),ud=ei(function(t,e){return t+e},0),cd=ui("ceil"),ld=ei(function(t,e){return t/e},1),fd=ui("floor"),pd=ei(function(t,e){return t*e},1),dd=ui("round"),hd=ei(function(t,e){return t-e},0);return n.after=Os,n.ary=As,n.assign=jp,n.assignIn=Pp,n.assignInWith=Tp,n.assignWith=Cp,n.at=Rp,n.before=Es,n.bind=ap,n.bindAll=Jp,n.bindKey=sp,n.castArray=Fs,n.chain=Za,n.chunk=ra,n.compact=oa,n.concat=ia,n.cond=Ec,n.conforms=jc,n.constant=Pc,n.countBy=Xf,n.create=Pu,n.curry=js,n.curryRight=Ps,n.debounce=Ts,n.defaults=Np,n.defaultsDeep=kp,n.defer=up,n.delay=cp,n.difference=kf,n.differenceBy=If,n.differenceWith=Bf,n.drop=aa,n.dropRight=sa,n.dropRightWhile=ua,n.dropWhile=ca,n.fill=la,n.filter=ss,n.flatMap=us,n.flatMapDeep=cs,n.flatMapDepth=ls,n.flatten=da,n.flattenDeep=ha,n.flattenDepth=ma,n.flip=Cs,n.flow=Qp,n.flowRight=td,n.fromPairs=ga,n.functions=Bu,n.functionsIn=Mu,n.groupBy=tp,n.initial=ya,n.intersection=Mf,n.intersectionBy=Lf,n.intersectionWith=Df,n.invert=Ip,n.invertBy=Bp,n.invokeMap=ep,n.iteratee=Rc,n.keyBy=np,n.keys=Gu,n.keysIn=zu,n.map=hs,n.mapKeys=Uu,n.mapValues=Wu,n.matches=Nc,n.matchesProperty=kc,n.memoize=Rs,n.merge=Lp,n.mergeWith=Dp,n.method=ed,n.methodOf=nd,n.mixin=Ic,n.negate=Ns,n.nthArg=Lc,n.omit=Fp,n.omitBy=Hu,n.once=ks,n.orderBy=ms,n.over=rd,n.overArgs=lp,n.overEvery=od,n.overSome=id,n.partial=fp,n.partialRight=pp,n.partition=rp,n.pick=Gp,n.pickBy=Vu,n.property=Dc,n.propertyOf=Fc,n.pull=Ff,n.pullAll=Oa,n.pullAllBy=Aa,n.pullAllWith=Ea,n.pullAt=Gf,n.range=ad,n.rangeRight=sd,n.rearg=dp,n.reject=bs,n.remove=ja,n.rest=Is,n.reverse=Pa,n.sampleSize=_s,n.set=Ku,n.setWith=Yu,n.shuffle=xs,n.slice=Ta,n.sortBy=op,n.sortedUniq=Ma,n.sortedUniqBy=La,n.split=mc,n.spread=Bs,n.tail=Da,n.take=Fa,n.takeRight=Ga,n.takeRightWhile=za,n.takeWhile=Ua,n.tap=Xa,n.throttle=Ms,n.thru=Ja,n.toArray=_u,n.toPairs=zp,n.toPairsIn=Up,n.toPath=qc,n.toPlainObject=Au,n.transform=$u,n.unary=Ls,n.union=zf,n.unionBy=Uf,n.unionWith=Wf,n.uniq=Wa,n.uniqBy=Ha,n.uniqWith=Va,n.unset=Zu,n.unzip=qa,n.unzipWith=Ka,n.update=Xu,n.updateWith=Ju,n.values=Qu,n.valuesIn=tc,n.without=Hf,n.words=Ac,n.wrap=Ds,n.xor=Vf,n.xorBy=qf,n.xorWith=Kf,n.zip=Yf,n.zipObject=Ya,n.zipObjectDeep=$a,n.zipWith=$f,n.entries=zp,n.entriesIn=Up,n.extend=Pp,n.extendWith=Tp,Ic(n,n),n.add=ud,n.attempt=Xp,n.camelCase=Wp,n.capitalize=oc,n.ceil=cd,n.clamp=ec,n.clone=Gs,n.cloneDeep=Us,n.cloneDeepWith=Ws,n.cloneWith=zs,n.conformsTo=Hs,n.deburr=ic,n.defaultTo=Tc,n.divide=ld,n.endsWith=ac,n.eq=Vs,n.escape=sc,n.escapeRegExp=uc,n.every=as,n.find=Jf,n.findIndex=fa,n.findKey=Tu,n.findLast=Qf,n.findLastIndex=pa,n.findLastKey=Cu,n.floor=fd,n.forEach=fs,n.forEachRight=ps,n.forIn=Ru,n.forInRight=Nu,n.forOwn=ku,n.forOwnRight=Iu,n.get=Lu,n.gt=hp,n.gte=mp,n.has=Du,n.hasIn=Fu,n.head=va,n.identity=Cc,n.includes=ds,n.indexOf=ba,n.inRange=nc,n.invoke=Mp,n.isArguments=gp,n.isArray=vp,n.isArrayBuffer=bp,n.isArrayLike=qs,n.isArrayLikeObject=Ks,n.isBoolean=Ys,n.isBuffer=yp,n.isDate=_p,n.isElement=$s,n.isEmpty=Zs,n.isEqual=Xs,n.isEqualWith=Js,n.isError=Qs,n.isFinite=tu,n.isFunction=eu,n.isInteger=nu,n.isLength=ru,n.isMap=xp,n.isMatch=au,n.isMatchWith=su,n.isNaN=uu,n.isNative=cu,n.isNil=fu,n.isNull=lu,n.isNumber=pu,n.isObject=ou,n.isObjectLike=iu,n.isPlainObject=du,n.isRegExp=wp,n.isSafeInteger=hu,n.isSet=Sp,n.isString=mu,n.isSymbol=gu,n.isTypedArray=Op,n.isUndefined=vu,n.isWeakMap=bu,n.isWeakSet=yu,n.join=_a,n.kebabCase=Hp,n.last=xa,n.lastIndexOf=wa,n.lowerCase=Vp,n.lowerFirst=qp,n.lt=Ap,n.lte=Ep,n.max=Yc,n.maxBy=$c,n.mean=Zc,n.meanBy=Xc,n.min=Jc,n.minBy=Qc,n.stubArray=Gc,n.stubFalse=zc,n.stubObject=Uc,n.stubString=Wc,n.stubTrue=Hc,n.multiply=pd,n.nth=Sa,n.noConflict=Bc,n.noop=Mc,n.now=ip,n.pad=cc,n.padEnd=lc,n.padStart=fc,n.parseInt=pc,n.random=rc,n.reduce=gs,n.reduceRight=vs,n.repeat=dc,n.replace=hc,n.result=qu,n.round=dd,n.runInContext=t,n.sample=ys,n.size=ws,n.snakeCase=Kp,n.some=Ss,n.sortedIndex=Ca,n.sortedIndexBy=Ra,n.sortedIndexOf=Na,n.sortedLastIndex=ka,n.sortedLastIndexBy=Ia,n.sortedLastIndexOf=Ba,n.startCase=Yp,n.startsWith=gc,n.subtract=hd,n.sum=tl,n.sumBy=el,n.template=vc,n.times=Vc,n.toFinite=xu,n.toInteger=wu,n.toLength=Su,n.toLower=bc,n.toNumber=Ou,n.toSafeInteger=Eu,n.toString=ju,n.toUpper=yc,n.trim=_c,n.trimEnd=xc,n.trimStart=wc,n.truncate=Sc,n.unescape=Oc,n.uniqueId=Kc,n.upperCase=$p,n.upperFirst=Zp,n.each=fs,n.eachRight=ps,n.first=va,Ic(n,function(){var t={};return dr(n,function(e,r){gl.call(n.prototype,r)||(t[r]=e)}),t}(),{chain:!1}),n.VERSION="4.17.4",u(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){n[t].placeholder=n}),u(["drop","take"],function(t,e){P.prototype[t]=function(n){n=n===rt?1:Vl(wu(n),0);var r=this.__filtered__&&!e?new P(this):this.clone();return r.__filtered__?r.__takeCount__=ql(n,r.__takeCount__):r.__views__.push({size:ql(n,Bt),type:t+(r.__dir__<0?"Right":"")}),r},P.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),u(["filter","map","takeWhile"],function(t,e){var n=e+1,r=n==Tt||3==n;P.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:wi(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),u(["head","last"],function(t,e){var n="take"+(e?"Right":"");P.prototype[t]=function(){return this[n](1).value()[0]}}),u(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");P.prototype[t]=function(){return this.__filtered__?new P(this):this[n](1)}}),P.prototype.compact=function(){return this.filter(Cc)},P.prototype.find=function(t){return this.filter(t).head()},P.prototype.findLast=function(t){return this.reverse().find(t)},P.prototype.invokeMap=no(function(t,e){return"function"==typeof t?new P(this):this.map(function(n){return Ar(n,t,e)})}),P.prototype.reject=function(t){return this.filter(Ns(wi(t)))},P.prototype.slice=function(t,e){t=wu(t);var n=this;return n.__filtered__&&(t>0||e<0)?new P(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==rt&&(e=wu(e),n=e<0?n.dropRight(-e):n.take(e-t)),n)},P.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},P.prototype.toArray=function(){return this.take(Bt)},dr(P.prototype,function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),o=/^(?:head|last)$/.test(e),i=n[o?"take"+("last"==e?"Right":""):e],a=o||/^find/.test(e);i&&(n.prototype[e]=function(){var e=this.__wrapped__,s=o?[1]:arguments,u=e instanceof P,c=s[0],l=u||vp(e),f=function(t){var e=i.apply(n,m([t],s));return o&&p?e[0]:e};l&&r&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,d=!!this.__actions__.length,h=a&&!p,g=u&&!d;if(!a&&l){e=g?e:new P(this);var v=t.apply(e,s);return v.__actions__.push({func:Ja,args:[f],thisArg:rt}),new y(v,p)}return h&&g?t.apply(this,s):(v=this.thru(f),h?o?v.value()[0]:v.value():v)})}),u(["pop","push","shift","sort","splice","unshift"],function(t){var e=fl[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",o=/^(?:pop|shift)$/.test(t);n.prototype[t]=function(){var t=arguments;if(o&&!this.__chain__){var n=this.value();return e.apply(vp(n)?n:[],t)}return this[r](function(n){return e.apply(vp(n)?n:[],t)})}}),dr(P.prototype,function(t,e){var r=n[e];if(r){var o=r.name+"";(of[o]||(of[o]=[])).push({name:e,func:r})}}),of[Qo(rt,gt).name]=[{name:"wrapper",func:rt}],P.prototype.clone=Z,P.prototype.reverse=tt,P.prototype.value=et,n.prototype.at=Zf,n.prototype.chain=Qa,n.prototype.commit=ts,n.prototype.next=es,n.prototype.plant=rs,n.prototype.reverse=os,n.prototype.toJSON=n.prototype.valueOf=n.prototype.value=is,n.prototype.first=n.prototype.head,Nl&&(n.prototype[Nl]=ns),n}();"function"==typeof t&&"object"==typeof t.amd&&t.amd?(Nn._=Yn,t(function(){return Yn})):In?((In.exports=Yn)._=Yn,kn._=Yn):Nn._=Yn}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],461:[function(t,e,n){function r(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(i);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(r.Cache||o),n}var o=t("./_MapCache"),i="Expected a function";r.Cache=o,e.exports=r},{"./_MapCache":206}],462:[function(t,e,n){function r(){}e.exports=r},{}],463:[function(t,e,n){var r=t("./_root"),o=function(){return r.Date.now()};e.exports=o},{"./_root":378}],464:[function(t,e,n){var r=t("./_arrayMap"),o=t("./_baseClone"),i=t("./_baseUnset"),a=t("./_castPath"),s=t("./_copyObject"),u=t("./_customOmitClone"),c=t("./_flatRest"),l=t("./_getAllKeysIn"),f=c(function(t,e){var n={};if(null==t)return n;var c=!1;e=r(e,function(e){return e=a(e,t),c||(c=e.length>1),e}),s(t,l(t),n),c&&(n=o(n,7,u));for(var f=e.length;f--;)i(n,e[f]);return n});e.exports=f},{"./_arrayMap":222,"./_baseClone":233,"./_baseUnset":274,"./_castPath":276,"./_copyObject":289,"./_customOmitClone":308,"./_flatRest":314,"./_getAllKeysIn":317}],465:[function(t,e,n){var r=t("./_basePick"),o=t("./_flatRest"),i=o(function(t,e){return null==t?{}:r(t,e)});e.exports=i},{"./_basePick":259,"./_flatRest":314}],466:[function(t,e,n){function r(t,e){if(null==t)return{};var n=o(s(t),function(t){return[t]});return e=i(e),a(t,n,function(t,n){return e(t,n[0])})}var o=t("./_arrayMap"),i=t("./_baseIteratee"),a=t("./_basePickBy"),s=t("./_getAllKeysIn");e.exports=r},{"./_arrayMap":222,"./_baseIteratee":253,"./_basePickBy":260,"./_getAllKeysIn":317}],467:[function(t,e,n){function r(t){return a(t)?o(s(t)):i(t)}var o=t("./_baseProperty"),i=t("./_basePropertyDeep"),a=t("./_isKey"),s=t("./_toKey");e.exports=r},{"./_baseProperty":261,"./_basePropertyDeep":262,"./_isKey":346,"./_toKey":394}],468:[function(t,e,n){var r=t("./_createRange"),o=r();e.exports=o},{"./_createRange":304}],469:[function(t,e,n){var r=t("./_createWrap"),o=t("./_flatRest"),i=o(function(t,e){return r(t,256,void 0,void 0,void 0,e)});e.exports=i},{"./_createWrap":307,"./_flatRest":314}],470:[function(t,e,n){function r(t,e,n){var r=u(t)?o:s,c=arguments.length<3;return r(t,a(e,4),n,c,i)}var o=t("./_arrayReduce"),i=t("./_baseEach"),a=t("./_baseIteratee"),s=t("./_baseReduce"),u=t("./isArray");e.exports=r},{"./_arrayReduce":224,"./_baseEach":235,"./_baseIteratee":253,"./_baseReduce":265,"./isArray":444}],471:[function(t,e,n){function r(){return[]}e.exports=r},{}],472:[function(t,e,n){function r(){return!1}e.exports=r},{}],473:[function(t,e,n){function r(t){if(!t)return 0===t?t:0;if((t=o(t))===i||t===-i){return(t<0?-1:1)*a}return t===t?t:0}var o=t("./toNumber"),i=1/0,a=1.7976931348623157e308;e.exports=r},{"./toNumber":475}],474:[function(t,e,n){function r(t){var e=o(t),n=e%1;return e===e?n?e-n:e:0}var o=t("./toFinite");e.exports=r},{"./toFinite":473}],475:[function(t,e,n){function r(t){if("number"==typeof t)return t;if(i(t))return a;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(s,"");var n=c.test(t);return n||l.test(t)?f(t.slice(2),n?2:8):u.test(t)?a:+t}var o=t("./isObject"),i=t("./isSymbol"),a=NaN,s=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,f=parseInt;e.exports=r},{"./isObject":451,"./isSymbol":454}],476:[function(t,e,n){function r(t){return a(t)?o(t,c):s(t)?[t]:i(u(l(t)))}var o=t("./_arrayMap"),i=t("./_copyArray"),a=t("./isArray"),s=t("./isSymbol"),u=t("./_stringToPath"),c=t("./_toKey"),l=t("./toString");e.exports=r},{"./_arrayMap":222,"./_copyArray":288,"./_stringToPath":393,"./_toKey":394,"./isArray":444,"./isSymbol":454,"./toString":477}],477:[function(t,e,n){function r(t){return null==t?"":o(t)}var o=t("./_baseToString");e.exports=r},{"./_baseToString":271}],478:[function(t,e,n){function r(t){return t&&t.length?o(t):[]}var o=t("./_baseUniq");e.exports=r},{"./_baseUniq":273
}],479:[function(t,e,n){var r=t("./_createCaseFirst"),o=r("toUpperCase");e.exports=o},{"./_createCaseFirst":297}],480:[function(t,e,n){function r(t,e,n){return t=a(t),e=n?void 0:e,void 0===e?i(t)?s(t):o(t):t.match(e)||[]}var o=t("./_asciiWords"),i=t("./_hasUnicodeWord"),a=t("./toString"),s=t("./_unicodeWords");e.exports=r},{"./_asciiWords":227,"./_hasUnicodeWord":333,"./_unicodeWords":397,"./toString":477}],481:[function(t,e,n){function r(t){if(u(t)&&!s(t)&&!(t instanceof o)){if(t instanceof i)return t;if(f.call(t,"__wrapped__"))return c(t)}return new i(t)}var o=t("./_LazyWrapper"),i=t("./_LodashWrapper"),a=t("./_baseLodash"),s=t("./isArray"),u=t("./isObjectLike"),c=t("./_wrapperClone"),l=Object.prototype,f=l.hasOwnProperty;r.prototype=a.prototype,r.prototype.constructor=r,e.exports=r},{"./_LazyWrapper":202,"./_LodashWrapper":204,"./_baseLodash":256,"./_wrapperClone":399,"./isArray":444,"./isObjectLike":452}],482:[function(e,n,r){!function(o,i){"object"==typeof r&&void 0!==n?n.exports=i(e("preact"),e("redux")):"function"==typeof t&&t.amd?t(["preact","redux"],i):o.preactRedux=i(o.preact,o.Redux)}(this,function(t,e){function n(){}function r(){var t=[],e=[];return{clear:function(){e=G,t=G},notify:function(){for(var n=t=e,r=0;r<n.length;r++)n[r]()},subscribe:function(n){var r=!0;return e===t&&(e=t.slice()),e.push(n),function(){r&&t!==G&&(r=!1,e===t&&(e=t.slice()),e.splice(e.indexOf(n),1))}}}}function o(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw new Error(t)}catch(t){}}function i(){H||(H=!0,o("<Provider> does not support changing `store` on the fly. It is most likely that you see this error because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers automatically. See https://github.com/reactjs/react-redux/releases/tag/v2.0.0 for the migration instructions."))}function a(e){var n,r,o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=o.getDisplayName,a=void 0===i?function(t){return"ConnectAdvanced("+t+")"}:i,s=o.methodName,u=void 0===s?"connectAdvanced":s,c=o.renderCountProp,l=void 0===c?void 0:c,f=o.shouldHandleStateChanges,p=void 0===f||f,d=o.storeKey,h=void 0===d?"store":d,m=o.withRef,g=void 0!==m&&m,v=D(o,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),b=h+"Subscription",y=X++,_=(n={},n[h]=W,n[b]=k.instanceOf(U),n),x=(r={},r[b]=k.instanceOf(U),r);return function(n){Z("function"==typeof n,"You must pass a component to the function returned by connect. Instead received "+n);var r=n.displayName||n.name||"Component",o=a(r),i=M({},v,{getDisplayName:a,methodName:u,renderCountProp:l,shouldHandleStateChanges:p,storeKey:h,withRef:g,displayName:o,wrappedComponentName:r,WrappedComponent:n}),s=function(r){function a(t,e){B(this,a);var n=F(this,r.call(this,t,e));return n.version=y,n.state={},n.renderCount=0,n.store=n.props[h]||n.context[h],n.parentSub=t[b]||e[b],n.setWrappedInstance=n.setWrappedInstance.bind(n),Z(n.store,'Could not find "'+h+'" in either the context or props of "'+o+'". Either wrap the root component in a <Provider>, or explicitly pass "'+h+'" as a prop to "'+o+'".'),n.getState=n.store.getState.bind(n.store),n.initSelector(),n.initSubscription(),n}return L(a,r),a.prototype.getChildContext=function(){var t;return t={},t[b]=this.subscription||this.parentSub,t},a.prototype.componentDidMount=function(){p&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},a.prototype.componentWillReceiveProps=function(t){this.selector.run(t)},a.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},a.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.store=null,this.parentSub=null,this.selector.run=function(){}},a.prototype.getWrappedInstance=function(){return Z(g,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+u+"() call."),this.wrappedInstance},a.prototype.setWrappedInstance=function(t){this.wrappedInstance=t},a.prototype.initSelector=function(){var t=this.store.dispatch,n=this.getState,r=e(t,i),o=this.selector={shouldComponentUpdate:!0,props:r(n(),this.props),run:function(t){try{var e=r(n(),t);(o.error||e!==o.props)&&(o.shouldComponentUpdate=!0,o.props=e,o.error=null)}catch(t){o.shouldComponentUpdate=!0,o.error=t}}}},a.prototype.initSubscription=function(){var t=this;p&&function(){var e=t.subscription=new U(t.store,t.parentSub),n={};e.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=function(){this.componentDidUpdate=void 0,e.notifyNestedSubs()},this.setState(n)):e.notifyNestedSubs()}.bind(t)}()},a.prototype.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},a.prototype.addExtraProps=function(t){if(!g&&!l)return t;var e=M({},t);return g&&(e.ref=this.setWrappedInstance),l&&(e[l]=this.renderCount++),e},a.prototype.render=function(){var e=this.selector;if(e.shouldComponentUpdate=!1,e.error)throw e.error;return t.h(n,this.addExtraProps(e.props))},a}(t.Component);return s.WrappedComponent=n,s.displayName=o,s.childContextTypes=x,s.contextTypes=_,s.prototype.componentWillUpdate=function(){this.version!==y&&(this.version=y,this.initSelector(),this.subscription&&this.subscription.tryUnsubscribe(),this.initSubscription(),p&&this.subscription.trySubscribe())},$(s,n)}}function s(t,e){if(t===e)return!0;var n=0,r=0;for(var o in t){if(J.call(t,o)&&t[o]!==e[o])return!1;n++}for(var i in e)J.call(e,i)&&r++;return n===r}function u(t){return Q(Object(t))}function c(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function l(t){return!!t&&"object"==(void 0===t?"undefined":I(t))}function f(t){if(!l(t)||it.call(t)!=tt||c(t))return!1;var e=u(t);if(null===e)return!0;var n=rt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&nt.call(n)==ot}function p(t,e,n){f(t)||o(n+"() in "+e+" must return a plain object. Instead received "+t+".")}function d(t){return function(e,n){function r(){return o}var o=t(e,n);return r.dependsOnOwnProps=!1,r}}function h(t){return null!==t.dependsOnOwnProps&&void 0!==t.dependsOnOwnProps?Boolean(t.dependsOnOwnProps):1!==t.length}function m(t,e){return function(n,r){var o=r.displayName,i=function(t,e){return i.dependsOnOwnProps?i.mapToProps(t,e):i.mapToProps(t)};return i.dependsOnOwnProps=h(t),i.mapToProps=function(n,r){i.mapToProps=t;var a=i(n,r);return"function"==typeof a&&(i.mapToProps=a,i.dependsOnOwnProps=h(a),a=i(n,r)),p(a,o,e),a},i}}function g(t){return"function"==typeof t?m(t,"mapDispatchToProps"):void 0}function v(t){return t?void 0:d(function(t){return{dispatch:t}})}function b(t){return t&&"object"===(void 0===t?"undefined":I(t))?d(function(n){return e.bindActionCreators(t,n)}):void 0}function y(t){return"function"==typeof t?m(t,"mapStateToProps"):void 0}function _(t){return t?void 0:d(function(){return{}})}function x(t,e,n){return M({},n,t,e)}function w(t){return function(e,n){var r=n.displayName,o=n.pure,i=n.areMergedPropsEqual,a=!1,s=void 0;return function(e,n,u){var c=t(e,n,u);return a?o&&i(c,s)||(s=c):(a=!0,s=c,p(s,r,"mergeProps")),s}}}function S(t){return"function"==typeof t?w(t):void 0}function O(t){return t?void 0:function(){return x}}function A(t,e,n){if(!t)throw new Error("Unexpected value for "+e+" in "+n+".");"mapStateToProps"!==e&&"mapDispatchToProps"!==e||t.hasOwnProperty("dependsOnOwnProps")||o("The selector for "+e+" of "+n+" did not specify a value for dependsOnOwnProps.")}function E(t,e,n,r){A(t,"mapStateToProps",r),A(e,"mapDispatchToProps",r),A(n,"mergeProps",r)}function j(t,e,n,r){return function(o,i){return n(t(o,i),e(r,i),i)}}function P(t,e,n,r,o){function i(o,i){return h=o,m=i,g=t(h,m),v=e(r,m),b=n(g,v,m),d=!0,b}function a(){return g=t(h,m),e.dependsOnOwnProps&&(v=e(r,m)),b=n(g,v,m)}function s(){return t.dependsOnOwnProps&&(g=t(h,m)),e.dependsOnOwnProps&&(v=e(r,m)),b=n(g,v,m)}function u(){var e=t(h,m),r=!p(e,g);return g=e,r&&(b=n(g,v,m)),b}function c(t,e){var n=!f(e,m),r=!l(t,h);return h=t,m=e,n&&r?a():n?s():r?u():b}var l=o.areStatesEqual,f=o.areOwnPropsEqual,p=o.areStatePropsEqual,d=!1,h=void 0,m=void 0,g=void 0,v=void 0,b=void 0;return function(t,e){return d?c(t,e):i(t,e)}}function T(t,e){var n=e.initMapStateToProps,r=e.initMapDispatchToProps,o=e.initMergeProps,i=D(e,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=n(t,i),s=r(t,i),u=o(t,i);return E(a,s,u,i.displayName),(i.pure?P:j)(a,s,u,t,i)}function C(t,e,n){for(var r=e.length-1;r>=0;r--){var o=e[r](t);if(o)return o}return function(e,r){throw new Error("Invalid value of type "+(void 0===t?"undefined":I(t))+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function R(t,e){return t===e}var N={only:function(t){return t&&t[0]||null}};n.isRequired=n;var k={element:n,func:n,shape:function(){return n},instanceOf:function(){return n}},I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},B=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},M=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},L=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},D=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},F=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},G=null,z={notify:function(){}},U=function(){function t(e,n){B(this,t),this.store=e,this.parentSub=n,this.unsubscribe=null,this.listeners=z}return t.prototype.addNestedSub=function(t){return this.trySubscribe(),this.listeners.subscribe(t)},t.prototype.notifyNestedSubs=function(){this.listeners.notify()},t.prototype.isSubscribed=function(){return Boolean(this.unsubscribe)},t.prototype.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=r())},t.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=z)},t}(),W=k.shape({subscribe:k.func.isRequired,dispatch:k.func.isRequired,getState:k.func.isRequired}),H=!1,V=function(t){function e(n,r){B(this,e);var o=F(this,t.call(this,n,r));return o.store=n.store,o}return L(e,t),e.prototype.getChildContext=function(){return{store:this.store,storeSubscription:null}},e.prototype.render=function(){return N.only(this.props.children)},e}(t.Component);V.prototype.componentWillReceiveProps=function(t){this.store!==t.store&&i()},V.childContextTypes={store:W.isRequired,storeSubscription:k.instanceOf(U)},V.displayName="Provider";var q={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},K={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},Y="function"==typeof Object.getOwnPropertySymbols,$=function(t,e,n){if("string"!=typeof e){var r=Object.getOwnPropertyNames(e);Y&&(r=r.concat(Object.getOwnPropertySymbols(e)));for(var o=0;o<r.length;++o)if(!(q[r[o]]||K[r[o]]||n&&n[r[o]]))try{t[r[o]]=e[r[o]]}catch(t){}}return t},Z=function(){},X=0,J=Object.prototype.hasOwnProperty,Q=Object.getPrototypeOf,tt="[object Object]",et=Object.prototype,nt=Function.prototype.toString,rt=et.hasOwnProperty,ot=nt.call(Object),it=et.toString,at=[g,v,b],st=[y,_],ut=[S,O];return{Provider:V,connect:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=t.connectHOC,n=void 0===e?a:e,r=t.mapStateToPropsFactories,o=void 0===r?st:r,i=t.mapDispatchToPropsFactories,u=void 0===i?at:i,c=t.mergePropsFactories,l=void 0===c?ut:c,f=t.selectorFactory,p=void 0===f?T:f;return function(t,e,r){var i=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],a=i.pure,c=void 0===a||a,f=i.areStatesEqual,d=void 0===f?R:f,h=i.areOwnPropsEqual,m=void 0===h?s:h,g=i.areStatePropsEqual,v=void 0===g?s:g,b=i.areMergedPropsEqual,y=void 0===b?s:b,_=D(i,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),x=C(t,o,"mapStateToProps"),w=C(e,u,"mapDispatchToProps"),S=C(r,l,"mergeProps");return n(p,M({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:Boolean(t),initMapStateToProps:x,initMapDispatchToProps:w,initMergeProps:S,pure:c,areStatesEqual:d,areOwnPropsEqual:m,areStatePropsEqual:v,areMergedPropsEqual:y},_))}}(),connectAdvanced:a}})},{preact:483,redux:502}],483:[function(t,e,n){!function(){"use strict";function t(){}function n(e,n){var r,o,i,a,s=k;for(a=arguments.length;a-- >2;)N.push(arguments[a]);for(n&&null!=n.children&&(N.length||N.push(n.children),delete n.children);N.length;)if((o=N.pop())&&void 0!==o.pop)for(a=o.length;a--;)N.push(o[a]);else!0!==o&&!1!==o||(o=null),(i="function"!=typeof e)&&(null==o?o="":"number"==typeof o?o=String(o):"string"!=typeof o&&(i=!1)),i&&r?s[s.length-1]+=o:s===k?s=[o]:s.push(o),r=i;var u=new t;return u.nodeName=e,u.children=s,u.attributes=null==n?void 0:n,u.key=null==n?void 0:n.key,void 0!==R.vnode&&R.vnode(u),u}function r(t,e){for(var n in e)t[n]=e[n];return t}function o(t,e){return n(t.nodeName,r(r({},t.attributes),e),arguments.length>2?[].slice.call(arguments,2):t.children)}function i(t){!t.__d&&(t.__d=!0)&&1==B.push(t)&&(R.debounceRendering||setTimeout)(a)}function a(){var t,e=B;for(B=[];t=e.pop();)t.__d&&E(t)}function s(t,e,n){return"string"==typeof e||"number"==typeof e?void 0!==t.splitText:"string"==typeof e.nodeName?!t._componentConstructor&&u(t,e.nodeName):n||t._componentConstructor===e.nodeName}function u(t,e){return t.__n===e||t.nodeName.toLowerCase()===e.toLowerCase()}function c(t){var e=r({},t.attributes);e.children=t.children;var n=t.nodeName.defaultProps;if(void 0!==n)for(var o in n)void 0===e[o]&&(e[o]=n[o]);return e}function l(t,e){var n=e?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t);return n.__n=t,n}function f(t){t.parentNode&&t.parentNode.removeChild(t)}function p(t,e,n,r,o){if("className"===e&&(e="class"),"key"===e);else if("ref"===e)n&&n(null),r&&r(t);else if("class"!==e||o)if("style"===e){if(r&&"string"!=typeof r&&"string"!=typeof n||(t.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var i in n)i in r||(t.style[i]="");for(var i in r)t.style[i]="number"==typeof r[i]&&!1===I.test(i)?r[i]+"px":r[i]}}else if("dangerouslySetInnerHTML"===e)r&&(t.innerHTML=r.__html||"");else if("o"==e[0]&&"n"==e[1]){var a=e!==(e=e.replace(/Capture$/,""));e=e.toLowerCase().substring(2),r?n||t.addEventListener(e,h,a):t.removeEventListener(e,h,a),(t.__l||(t.__l={}))[e]=r}else if("list"!==e&&"type"!==e&&!o&&e in t)d(t,e,null==r?"":r),null!=r&&!1!==r||t.removeAttribute(e);else{var s=o&&e!==(e=e.replace(/^xlink\:?/,""));null==r||!1===r?s?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.removeAttribute(e):"function"!=typeof r&&(s?t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),r):t.setAttribute(e,r))}else t.className=r||""}function d(t,e,n){try{t[e]=n}catch(t){}}function h(t){return this.__l[t.type](R.event&&R.event(t)||t)}function m(){for(var t;t=M.pop();)R.afterMount&&R.afterMount(t),t.componentDidMount&&t.componentDidMount()}function g(t,e,n,r,o,i){L++||(D=null!=o&&void 0!==o.ownerSVGElement,F=null!=t&&!("__preactattr_"in t));var a=v(t,e,n,r,i);return o&&a.parentNode!==o&&o.appendChild(a),--L||(F=!1,i||m()),a}function v(t,e,n,r,o){var i=t,a=D;if(null==e&&(e=""),"string"==typeof e)return t&&void 0!==t.splitText&&t.parentNode&&(!t._component||o)?t.nodeValue!=e&&(t.nodeValue=e):(i=document.createTextNode(e),t&&(t.parentNode&&t.parentNode.replaceChild(i,t),y(t,!0))),i.__preactattr_=!0,i;if("function"==typeof e.nodeName)return j(t,e,n,r);if(D="svg"===e.nodeName||"foreignObject"!==e.nodeName&&D,(!t||!u(t,String(e.nodeName)))&&(i=l(String(e.nodeName),D),t)){for(;t.firstChild;)i.appendChild(t.firstChild);t.parentNode&&t.parentNode.replaceChild(i,t),y(t,!0)}var s=i.firstChild,c=i.__preactattr_||(i.__preactattr_={}),f=e.children;return!F&&f&&1===f.length&&"string"==typeof f[0]&&null!=s&&void 0!==s.splitText&&null==s.nextSibling?s.nodeValue!=f[0]&&(s.nodeValue=f[0]):(f&&f.length||null!=s)&&b(i,f,n,r,F||null!=c.dangerouslySetInnerHTML),x(i,e.attributes,c),D=a,i}function b(t,e,n,r,o){var i,a,u,c,l=t.childNodes,p=[],d={},h=0,m=0,g=l.length,b=0,_=e?e.length:0;if(0!==g)for(var x=0;x<g;x++){var w=l[x],S=w.__preactattr_,O=_&&S?w._component?w._component.__k:S.key:null;null!=O?(h++,d[O]=w):(S||(void 0!==w.splitText?!o||w.nodeValue.trim():o))&&(p[b++]=w)}if(0!==_)for(var x=0;x<_;x++){u=e[x],c=null;var O=u.key;if(null!=O)h&&void 0!==d[O]&&(c=d[O],d[O]=void 0,h--);else if(!c&&m<b)for(i=m;i<b;i++)if(void 0!==p[i]&&s(a=p[i],u,o)){c=a,p[i]=void 0,i===b-1&&b--,i===m&&m++;break}c=v(c,u,n,r),c&&c!==t&&(x>=g?t.appendChild(c):c!==l[x]&&(c===l[x+1]?f(l[x]):t.insertBefore(c,l[x]||null)))}if(h)for(var x in d)void 0!==d[x]&&y(d[x],!1);for(;m<=b;)void 0!==(c=p[b--])&&y(c,!1)}function y(t,e){var n=t._component;n?P(n):(null!=t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),!1!==e&&null!=t.__preactattr_||f(t),_(t))}function _(t){for(t=t.lastChild;t;){var e=t.previousSibling;y(t,!0),t=e}}function x(t,e,n){var r;for(r in n)e&&null!=e[r]||null==n[r]||p(t,r,n[r],n[r]=void 0,D);for(r in e)"children"===r||"innerHTML"===r||r in n&&e[r]===("value"===r||"checked"===r?t[r]:n[r])||p(t,r,n[r],n[r]=e[r],D)}function w(t){var e=t.constructor.name;(G[e]||(G[e]=[])).push(t)}function S(t,e,n){var r,o=G[t.name];if(t.prototype&&t.prototype.render?(r=new t(e,n),T.call(r,e,n)):(r=new T(e,n),r.constructor=t,r.render=O),o)for(var i=o.length;i--;)if(o[i].constructor===t){r.__b=o[i].__b,o.splice(i,1);break}return r}function O(t,e,n){return this.constructor(t,n)}function A(t,e,n,r,o){t.__x||(t.__x=!0,(t.__r=e.ref)&&delete e.ref,(t.__k=e.key)&&delete e.key,!t.base||o?t.componentWillMount&&t.componentWillMount():t.componentWillReceiveProps&&t.componentWillReceiveProps(e,r),r&&r!==t.context&&(t.__c||(t.__c=t.context),t.context=r),t.__p||(t.__p=t.props),t.props=e,t.__x=!1,0!==n&&(1!==n&&!1===R.syncComponentUpdates&&t.base?i(t):E(t,1,o)),t.__r&&t.__r(t))}function E(t,e,n,o){if(!t.__x){var i,a,s,u=t.props,l=t.state,f=t.context,p=t.__p||u,d=t.__s||l,h=t.__c||f,v=t.base,b=t.__b,_=v||b,x=t._component,w=!1;if(v&&(t.props=p,t.state=d,t.context=h,2!==e&&t.shouldComponentUpdate&&!1===t.shouldComponentUpdate(u,l,f)?w=!0:t.componentWillUpdate&&t.componentWillUpdate(u,l,f),t.props=u,t.state=l,t.context=f),t.__p=t.__s=t.__c=t.__b=null,t.__d=!1,!w){i=t.render(u,l,f),t.getChildContext&&(f=r(r({},f),t.getChildContext()));var O,j,T=i&&i.nodeName;if("function"==typeof T){var C=c(i);a=x,a&&a.constructor===T&&C.key==a.__k?A(a,C,1,f,!1):(O=a,t._component=a=S(T,C,f),a.__b=a.__b||b,a.__u=t,A(a,C,0,f,!1),E(a,1,n,!0)),j=a.base}else s=_,O=x,O&&(s=t._component=null),(_||1===e)&&(s&&(s._component=null),j=g(s,i,f,n||!v,_&&_.parentNode,!0));if(_&&j!==_&&a!==x){var N=_.parentNode;N&&j!==N&&(N.replaceChild(j,_),O||(_._component=null,y(_,!1)))}if(O&&P(O),t.base=j,j&&!o){for(var k=t,I=t;I=I.__u;)(k=I).base=j;j._component=k,j._componentConstructor=k.constructor}}if(!v||n?M.unshift(t):w||(m(),t.componentDidUpdate&&t.componentDidUpdate(p,d,h),R.afterUpdate&&R.afterUpdate(t)),null!=t.__h)for(;t.__h.length;)t.__h.pop().call(t);L||o||m()}}function j(t,e,n,r){for(var o=t&&t._component,i=o,a=t,s=o&&t._componentConstructor===e.nodeName,u=s,l=c(e);o&&!u&&(o=o.__u);)u=o.constructor===e.nodeName;return o&&u&&(!r||o._component)?(A(o,l,3,n,r),t=o.base):(i&&!s&&(P(i),t=a=null),o=S(e.nodeName,l,n),t&&!o.__b&&(o.__b=t,a=null),A(o,l,1,n,r),t=o.base,a&&t!==a&&(a._component=null,y(a,!1))),t}function P(t){R.beforeUnmount&&R.beforeUnmount(t);var e=t.base;t.__x=!0,t.componentWillUnmount&&t.componentWillUnmount(),t.base=null;var n=t._component;n?P(n):e&&(e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),t.__b=e,f(e),w(t),_(e)),t.__r&&t.__r(null)}function T(t,e){this.__d=!0,this.context=e,this.props=t,this.state=this.state||{}}function C(t,e,n){return g(n,t,{},!1,e,!1)}var R={},N=[],k=[],I=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,B=[],M=[],L=0,D=!1,F=!1,G={};r(T.prototype,{setState:function(t,e){var n=this.state;this.__s||(this.__s=r({},n)),r(n,"function"==typeof t?t(n,this.props):t),e&&(this.__h=this.__h||[]).push(e),i(this)},forceUpdate:function(t){t&&(this.__h=this.__h||[]).push(t),E(this,2)},render:function(){}});var z={h:n,createElement:n,cloneElement:o,Component:T,render:C,rerender:a,options:R};void 0!==e?e.exports=z:self.preact=z}()},{}],484:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function a(t){if(p===clearTimeout)return clearTimeout(t);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function s(){g&&h&&(g=!1,h.length?m=h.concat(m):v=-1,m.length&&u())}function u(){if(!g){var t=i(s);g=!0;for(var e=m.length;e;){for(h=m,m=[];++v<e;)h&&h[v].run();v=-1,e=m.length}h=null,g=!1,a(t)}}function c(t,e){this.fun=t,this.array=e}function l(){}var f,p,d=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:r}catch(t){f=r}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(t){p=o}}();var h,m=[],g=!1,v=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];m.push(new c(t,e)),1!==m.length||g||i(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.prependListener=l,d.prependOnceListener=l,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},{}],485:[function(t,e,n){"use strict";e.exports=t("./lib/core.js"),t("./lib/done.js"),t("./lib/es6-extensions.js"),t("./lib/node-extensions.js")},{"./lib/core.js":486,"./lib/done.js":487,"./lib/es6-extensions.js":488,"./lib/node-extensions.js":489}],486:[function(t,e,n){"use strict";function r(t){function e(t){if(null===u)return void l.push(t);a(function(){var e=u?t.onFulfilled:t.onRejected;if(null===e)return void(u?t.resolve:t.reject)(c);var n;try{n=e(c)}catch(e){return void t.reject(e)}t.resolve(n)})}function n(t){try{if(t===f)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void i(e.bind(t),n,r)}u=!0,c=t,s()}catch(t){r(t)}}function r(t){u=!1,c=t,s()}function s(){for(var t=0,n=l.length;t<n;t++)e(l[t]);l=null}if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");var u=null,c=null,l=[],f=this;this.then=function(t,n){return new f.constructor(function(r,i){e(new o(t,n,r,i))})},i(t,n,r)}function o(t,e,n,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=r}function i(t,e,n){var r=!1;try{t(function(t){r||(r=!0,e(t))},function(t){r||(r=!0,n(t))})}catch(t){if(r)return;r=!0,n(t)}}var a=t("asap");e.exports=r},{asap:1}],487:[function(t,e,n){"use strict";var r=t("./core.js"),o=t("asap");e.exports=r,r.prototype.done=function(t,e){(arguments.length?this.then.apply(this,arguments):this).then(null,function(t){o(function(){throw t})})}},{"./core.js":486,asap:1}],488:[function(t,e,n){"use strict";function r(t){this.then=function(e){return"function"!=typeof e?this:new o(function(n,r){i(function(){try{n(e(t))}catch(t){r(t)}})})}}var o=t("./core.js"),i=t("asap");e.exports=o,r.prototype=o.prototype;var a=new r(!0),s=new r(!1),u=new r(null),c=new r(void 0),l=new r(0),f=new r("");o.resolve=function(t){if(t instanceof o)return t;if(null===t)return u;if(void 0===t)return c;if(!0===t)return a;if(!1===t)return s;if(0===t)return l;if(""===t)return f;if("object"==typeof t||"function"==typeof t)try{var e=t.then;if("function"==typeof e)return new o(e.bind(t))}catch(t){return new o(function(e,n){n(t)})}return new r(t)},o.all=function(t){var e=Array.prototype.slice.call(t);return new o(function(t,n){function r(i,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(t){r(i,t)},n)}e[i]=a,0==--o&&t(e)}catch(t){n(t)}}if(0===e.length)return t([]);for(var o=e.length,i=0;i<e.length;i++)r(i,e[i])})},o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,n){t.forEach(function(t){o.resolve(t).then(e,n)})})},o.prototype.catch=function(t){return this.then(null,t)}},{"./core.js":486,asap:1}],489:[function(t,e,n){"use strict";var r=t("./core.js"),o=t("asap");e.exports=r,r.denodeify=function(t,e){return e=e||1/0,function(){var n=this,o=Array.prototype.slice.call(arguments);return new r(function(r,i){for(;o.length&&o.length>e;)o.pop();o.push(function(t,e){t?i(t):r(e)});var a=t.apply(n,o);!a||"object"!=typeof a&&"function"!=typeof a||"function"!=typeof a.then||r(a)})}},r.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),n="function"==typeof e[e.length-1]?e.pop():null,i=this;try{return t.apply(this,arguments).nodeify(n,i)}catch(t){if(null===n||void 0===n)return new r(function(e,n){n(t)});o(function(){n.call(i,t)})}}},r.prototype.nodeify=function(t,e){if("function"!=typeof t)return this;this.then(function(n){o(function(){t.call(e,null,n)})},function(n){o(function(){t.call(e,n)})})}},{"./core.js":486,asap:1}],490:[function(e,n,r){(function(e){!function(o){function i(t){throw new RangeError(I[t])}function a(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function s(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(k,"."),r+a(t.split("."),e).join(".")}function u(t){for(var e,n,r=[],o=0,i=t.length;o<i;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<i?(n=t.charCodeAt(o++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--)):r.push(e);return r}function c(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=L(t>>>10&1023|55296),t=56320|1023&t),e+=L(t)}).join("")}function l(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:S}function f(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function p(t,e,n){var r=0;for(t=n?M(t/j):t>>1,t+=M(t/e);t>B*A>>1;r+=S)t=M(t/B);return M(r+(B+1)*t/(t+E))}function d(t){var e,n,r,o,a,s,u,f,d,h,m=[],g=t.length,v=0,b=T,y=P;for(n=t.lastIndexOf(C),n<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&i("not-basic"),m.push(t.charCodeAt(r));for(o=n>0?n+1:0;o<g;){for(a=v,s=1,u=S;o>=g&&i("invalid-input"),f=l(t.charCodeAt(o++)),(f>=S||f>M((w-v)/s))&&i("overflow"),v+=f*s,d=u<=y?O:u>=y+A?A:u-y,!(f<d);u+=S)h=S-d,s>M(w/h)&&i("overflow"),s*=h;e=m.length+1,y=p(v-a,e,0==a),M(v/e)>w-b&&i("overflow"),b+=M(v/e),v%=e,m.splice(v++,0,b)}return c(m)}function h(t){var e,n,r,o,a,s,c,l,d,h,m,g,v,b,y,_=[];for(t=u(t),g=t.length,e=T,n=0,a=P,s=0;s<g;++s)(m=t[s])<128&&_.push(L(m));for(r=o=_.length,o&&_.push(C);r<g;){for(c=w,s=0;s<g;++s)(m=t[s])>=e&&m<c&&(c=m);for(v=r+1,c-e>M((w-n)/v)&&i("overflow"),n+=(c-e)*v,e=c,s=0;s<g;++s)if(m=t[s],m<e&&++n>w&&i("overflow"),m==e){for(l=n,d=S;h=d<=a?O:d>=a+A?A:d-a,!(l<h);d+=S)y=l-h,b=S-h,_.push(L(f(h+y%b,0))),l=M(y/b);_.push(L(f(l,0))),a=p(n,v,r==o),n=0,++r}++n,++e}return _.join("")}function m(t){return s(t,function(t){return R.test(t)?d(t.slice(4).toLowerCase()):t})}function g(t){return s(t,function(t){return N.test(t)?"xn--"+h(t):t})}var v="object"==typeof r&&r&&!r.nodeType&&r,b="object"==typeof n&&n&&!n.nodeType&&n,y="object"==typeof e&&e;y.global!==y&&y.window!==y&&y.self!==y||(o=y);var _,x,w=2147483647,S=36,O=1,A=26,E=38,j=700,P=72,T=128,C="-",R=/^xn--/,N=/[^\x20-\x7E]/,k=/[\x2E\u3002\uFF0E\uFF61]/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},B=S-O,M=Math.floor,L=String.fromCharCode;if(_={version:"1.4.1",ucs2:{decode:u,encode:c},decode:d,encode:h,toASCII:g,toUnicode:m},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return _});else if(v&&b)if(n.exports==v)b.exports=_;else for(x in _)_.hasOwnProperty(x)&&(v[x]=_[x]);else o.punycode=_}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],491:[function(t,e,n){"use strict";var r=t("strict-uri-encode");n.extract=function(t){return t.split("?")[1]||""},n.parse=function(t){return"string"!=typeof t?{}:(t=t.trim().replace(/^(\?|#|&)/,""),t?t.split("&").reduce(function(t,e){var n=e.replace(/\+/g," ").split("="),r=n.shift(),o=n.length>0?n.join("="):void 0;return r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),t.hasOwnProperty(r)?Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]:t[r]=o,t},{}):{})},n.stringify=function(t){return t?Object.keys(t).sort().map(function(e){var n=t[e];return Array.isArray(n)?n.sort().map(function(t){return r(e)+"="+r(t)}).join("&"):r(e)+"="+r(n)}).filter(function(t){return t.length>0}).join("&"):""}},{"strict-uri-encode":506}],492:[function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,n,i){e=e||"&",n=n||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,p,d,h,m=t[l].replace(s,"%20"),g=m.indexOf(n);g>=0?(f=m.substr(0,g),p=m.substr(g+1)):(f=m,p=""),d=decodeURIComponent(f),h=decodeURIComponent(p),r(a,d)?o(a[d])?a[d].push(h):a[d]=[a[d],h]:a[d]=h}return a};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],493:[function(t,e,n){"use strict";function r(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r<t.length;r++)n.push(e(t[r],r));return n}var o=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,n,s){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?r(a(t),function(a){var s=encodeURIComponent(o(a))+n;return i(t[a])?r(t[a],function(t){return s+encodeURIComponent(o(t))}).join(e):s+encodeURIComponent(o(t[a]))}).join(e):s?encodeURIComponent(o(s))+n+encodeURIComponent(o(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},a=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},{}],494:[function(t,e,n){"use strict";n.decode=n.parse=t("./decode"),n.encode=n.stringify=t("./encode")},{"./decode":492,"./encode":493}],495:[function(e,n,r){(function(e){!function(e,o){"object"==typeof r&&void 0!==n?o(r):"function"==typeof t&&t.amd?t(["exports"],o):o(e.reduxLogger=e.reduxLogger||{})}(this,function(t){
"use strict";function n(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}function r(t,e){Object.defineProperty(this,"kind",{value:t,enumerable:!0}),e&&e.length&&Object.defineProperty(this,"path",{value:e,enumerable:!0})}function o(t,e,n){o.super_.call(this,"E",t),Object.defineProperty(this,"lhs",{value:e,enumerable:!0}),Object.defineProperty(this,"rhs",{value:n,enumerable:!0})}function i(t,e){i.super_.call(this,"N",t),Object.defineProperty(this,"rhs",{value:e,enumerable:!0})}function a(t,e){a.super_.call(this,"D",t),Object.defineProperty(this,"lhs",{value:e,enumerable:!0})}function s(t,e,n){s.super_.call(this,"A",t),Object.defineProperty(this,"index",{value:e,enumerable:!0}),Object.defineProperty(this,"item",{value:n,enumerable:!0})}function u(t,e,n){var r=t.slice((n||e)+1||t.length);return t.length=e<0?t.length+e:e,t.push.apply(t,r),t}function c(t){var e=void 0===t?"undefined":C(t);return"object"!==e?e:t===Math?"math":null===t?"null":Array.isArray(t)?"array":"[object Date]"===Object.prototype.toString.call(t)?"date":"function"==typeof t.toString&&/^\/.*\//.test(t.toString())?"regexp":"object"}function l(t,e,n,r,f,p,d){f=f||[],d=d||[];var h=f.slice(0);if(void 0!==p){if(r){if("function"==typeof r&&r(h,p))return;if("object"===(void 0===r?"undefined":C(r))){if(r.prefilter&&r.prefilter(h,p))return;if(r.normalize){var m=r.normalize(h,p,t,e);m&&(t=m[0],e=m[1])}}}h.push(p)}"regexp"===c(t)&&"regexp"===c(e)&&(t=t.toString(),e=e.toString());var g=void 0===t?"undefined":C(t),v=void 0===e?"undefined":C(e),b="undefined"!==g||d&&d[d.length-1].lhs&&d[d.length-1].lhs.hasOwnProperty(p),y="undefined"!==v||d&&d[d.length-1].rhs&&d[d.length-1].rhs.hasOwnProperty(p);if(!b&&y)n(new i(h,e));else if(!y&&b)n(new a(h,t));else if(c(t)!==c(e))n(new o(h,t,e));else if("date"===c(t)&&t-e!=0)n(new o(h,t,e));else if("object"===g&&null!==t&&null!==e)if(d.filter(function(e){return e.lhs===t}).length)t!==e&&n(new o(h,t,e));else{if(d.push({lhs:t,rhs:e}),Array.isArray(t)){var _;for(t.length,_=0;_<t.length;_++)_>=e.length?n(new s(h,_,new a(void 0,t[_]))):l(t[_],e[_],n,r,h,_,d);for(;_<e.length;)n(new s(h,_,new i(void 0,e[_++])))}else{var x=Object.keys(t),w=Object.keys(e);x.forEach(function(o,i){var a=w.indexOf(o);a>=0?(l(t[o],e[o],n,r,h,o,d),w=u(w,a)):l(t[o],void 0,n,r,h,o,d)}),w.forEach(function(t){l(void 0,e[t],n,r,h,t,d)})}d.length=d.length-1}else t!==e&&("number"===g&&isNaN(t)&&isNaN(e)||n(new o(h,t,e)))}function f(t,e,n,r){return r=r||[],l(t,e,function(t){t&&r.push(t)},n),r.length?r:void 0}function p(t,e,n){if(n.path&&n.path.length){var r,o=t[e],i=n.path.length-1;for(r=0;r<i;r++)o=o[n.path[r]];switch(n.kind){case"A":p(o[n.path[r]],n.index,n.item);break;case"D":delete o[n.path[r]];break;case"E":case"N":o[n.path[r]]=n.rhs}}else switch(n.kind){case"A":p(t[e],n.index,n.item);break;case"D":t=u(t,e);break;case"E":case"N":t[e]=n.rhs}return t}function d(t,e,n){if(t&&e&&n&&n.kind){for(var r=t,o=-1,i=n.path?n.path.length-1:0;++o<i;)void 0===r[n.path[o]]&&(r[n.path[o]]="number"==typeof n.path[o]?[]:{}),r=r[n.path[o]];switch(n.kind){case"A":p(n.path?r[n.path[o]]:r,n.index,n.item);break;case"D":delete r[n.path[o]];break;case"E":case"N":r[n.path[o]]=n.rhs}}}function h(t,e,n){if(n.path&&n.path.length){var r,o=t[e],i=n.path.length-1;for(r=0;r<i;r++)o=o[n.path[r]];switch(n.kind){case"A":h(o[n.path[r]],n.index,n.item);break;case"D":case"E":o[n.path[r]]=n.lhs;break;case"N":delete o[n.path[r]]}}else switch(n.kind){case"A":h(t[e],n.index,n.item);break;case"D":case"E":t[e]=n.lhs;break;case"N":t=u(t,e)}return t}function m(t,e,n){if(t&&e&&n&&n.kind){var r,o,i=t;for(o=n.path.length-1,r=0;r<o;r++)void 0===i[n.path[r]]&&(i[n.path[r]]={}),i=i[n.path[r]];switch(n.kind){case"A":h(i[n.path[r]],n.index,n.item);break;case"D":case"E":i[n.path[r]]=n.lhs;break;case"N":delete i[n.path[r]]}}}function g(t,e,n){if(t&&e){l(t,e,function(r){n&&!n(t,e,r)||d(t,e,r)})}}function v(t){return"color: "+k[t].color+"; font-weight: bold"}function b(t){var e=t.kind,n=t.path,r=t.lhs,o=t.rhs,i=t.index,a=t.item;switch(e){case"E":return[n.join("."),r,"→",o];case"N":return[n.join("."),o];case"D":return[n.join(".")];case"A":return[n.join(".")+"["+i+"]",a];default:return[]}}function y(t,e,n,r){var o=f(t,e);try{r?n.groupCollapsed("diff"):n.group("diff")}catch(t){n.log("diff")}o?o.forEach(function(t){var e=t.kind,r=b(t);n.log.apply(n,["%c "+k[e].text,v(e)].concat(R(r)))}):n.log("—— no diff ——");try{n.groupEnd()}catch(t){n.log("—— diff end —— ")}}function _(t,e,n,r){switch(void 0===t?"undefined":C(t)){case"object":return"function"==typeof t[r]?t[r].apply(t,R(n)):t[r];case"function":return t(e);default:return t}}function x(t){var e=t.timestamp,n=t.duration;return function(t,r,o){var i=["action"];return i.push("%c"+String(t.type)),e&&i.push("%c@ "+r),n&&i.push("%c(in "+o.toFixed(2)+" ms)"),i.join(" ")}}function w(t,e){var n=e.logger,r=e.actionTransformer,o=e.titleFormatter,i=void 0===o?x(e):o,a=e.collapsed,s=e.colors,u=e.level,c=e.diff,l=void 0===e.titleFormatter;t.forEach(function(o,f){var p=o.started,d=o.startedTime,h=o.action,m=o.prevState,g=o.error,v=o.took,b=o.nextState,x=t[f+1];x&&(b=x.prevState,v=x.started-p);var w=r(h),S="function"==typeof a?a(function(){return b},h,o):a,O=P(d),A=s.title?"color: "+s.title(w)+";":"",E=["color: gray; font-weight: lighter;"];E.push(A),e.timestamp&&E.push("color: gray; font-weight: lighter;"),e.duration&&E.push("color: gray; font-weight: lighter;");var j=i(w,O,v);try{S?s.title&&l?n.groupCollapsed.apply(n,["%c "+j].concat(E)):n.groupCollapsed(j):s.title&&l?n.group.apply(n,["%c "+j].concat(E)):n.group(j)}catch(t){n.log(j)}var T=_(u,w,[m],"prevState"),C=_(u,w,[w],"action"),R=_(u,w,[g,m],"error"),N=_(u,w,[b],"nextState");if(T)if(s.prevState){var k="color: "+s.prevState(m)+"; font-weight: bold";n[T]("%c prev state",k,m)}else n[T]("prev state",m);if(C)if(s.action){var I="color: "+s.action(w)+"; font-weight: bold";n[C]("%c action ",I,w)}else n[C]("action ",w);if(g&&R)if(s.error){var B="color: "+s.error(g,m)+"; font-weight: bold;";n[R]("%c error ",B,g)}else n[R]("error ",g);if(N)if(s.nextState){var M="color: "+s.nextState(b)+"; font-weight: bold";n[N]("%c next state",M,b)}else n[N]("next state",b);c&&y(m,b,n,S);try{n.groupEnd()}catch(t){n.log("—— log end ——")}})}function S(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},I,t),n=e.logger,r=e.stateTransformer,o=e.errorTransformer,i=e.predicate,a=e.logErrors,s=e.diffPredicate;if(void 0===n)return function(){return function(t){return function(e){return t(e)}}};if(t.getState&&t.dispatch)return console.error("[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware:\n// Logger with default options\nimport { logger } from 'redux-logger'\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n// Or you can create your own logger with custom options http://bit.ly/redux-logger-options\nimport createLogger from 'redux-logger'\nconst logger = createLogger({\n // ...options\n});\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n"),function(){return function(t){return function(e){return t(e)}}};var u=[];return function(t){var n=t.getState;return function(t){return function(c){if("function"==typeof i&&!i(n,c))return t(c);var l={};u.push(l),l.started=T.now(),l.startedTime=new Date,l.prevState=r(n()),l.action=c;var f=void 0;if(a)try{f=t(c)}catch(t){l.error=o(t)}else f=t(c);l.took=T.now()-l.started,l.nextState=r(n());var p=e.diff&&"function"==typeof s?s(n,c):e.diff;if(w(u,Object.assign({},e,{diff:p})),u.length=0,l.error)throw l.error;return f}}}}var O,A,E=function(t,e){return new Array(e+1).join(t)},j=function(t,e){return E("0",e-t.toString().length)+t},P=function(t){return j(t.getHours(),2)+":"+j(t.getMinutes(),2)+":"+j(t.getSeconds(),2)+"."+j(t.getMilliseconds(),3)},T="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance:Date,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)},N=[];O="object"===(void 0===e?"undefined":C(e))&&e?e:"undefined"!=typeof window?window:{},A=O.DeepDiff,A&&N.push(function(){void 0!==A&&O.DeepDiff===f&&(O.DeepDiff=A,A=void 0)}),n(o,r),n(i,r),n(a,r),n(s,r),Object.defineProperties(f,{diff:{value:f,enumerable:!0},observableDiff:{value:l,enumerable:!0},applyDiff:{value:g,enumerable:!0},applyChange:{value:d,enumerable:!0},revertChange:{value:m,enumerable:!0},isConflict:{value:function(){return void 0!==A},enumerable:!0},noConflict:{value:function(){return N&&(N.forEach(function(t){t()}),N=null),f},enumerable:!0}});var k={E:{color:"#2196F3",text:"CHANGED:"},N:{color:"#4CAF50",text:"ADDED:"},D:{color:"#F44336",text:"DELETED:"},A:{color:"#2196F3",text:"ARRAY:"}},I={level:"log",logger:console,logErrors:!0,collapsed:void 0,predicate:void 0,duration:!1,timestamp:!0,stateTransformer:function(t){return t},actionTransformer:function(t){return t},errorTransformer:function(t){return t},colors:{title:function(){return"inherit"},prevState:function(){return"#9E9E9E"},action:function(){return"#03A9F4"},nextState:function(){return"#4CAF50"},error:function(){return"#F20404"}},diff:!1,diffPredicate:void 0,transformer:void 0},B=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.dispatch,n=t.getState;return"function"==typeof e||"function"==typeof n?S()({dispatch:e,getState:n}):void console.error("\n[redux-logger v3] BREAKING CHANGE\n[redux-logger v3] Since 3.0.0 redux-logger exports by default logger with default settings.\n[redux-logger v3] Change\n[redux-logger v3] import createLogger from 'redux-logger'\n[redux-logger v3] to\n[redux-logger v3] import { createLogger } from 'redux-logger'\n")};t.defaults=I,t.createLogger=S,t.logger=B,t.default=B,Object.defineProperty(t,"__esModule",{value:!0})})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],496:[function(t,e,n){"use strict";function r(t){return function(e){var n=e.dispatch,r=e.getState;return function(e){return function(o){return"function"==typeof o?o(n,r,t):e(o)}}}}n.__esModule=!0;var o=r();o.withExtraArgument=r,n.default=o},{}],497:[function(t,e,n){"use strict";function r(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){return function(n,r,i){var s=t(n,r,i),u=s.dispatch,c=[],l={getState:s.getState,dispatch:function(t){return u(t)}};return c=e.map(function(t){return t(l)}),u=a.default.apply(void 0,c)(s.dispatch),o({},s,{dispatch:u})}}}n.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.default=r;var i=t("./compose"),a=function(t){return t&&t.__esModule?t:{default:t}}(i)},{"./compose":500}],498:[function(t,e,n){"use strict";function r(t,e){return function(){return e(t.apply(void 0,arguments))}}function o(t,e){if("function"==typeof t)return r(t,e);if("object"!=typeof t||null===t)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===t?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(t),o={},i=0;i<n.length;i++){var a=n[i],s=t[a];"function"==typeof s&&(o[a]=r(s,e))}return o}n.__esModule=!0,n.default=o},{}],499:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n=e&&e.type;return"Given action "+(n&&'"'+n.toString()+'"'||"an action")+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state.'}function i(t){Object.keys(t).forEach(function(e){var n=t[e];if(void 0===n(void 0,{type:s.ActionTypes.INIT}))throw new Error('Reducer "'+e+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');if(void 0===n(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw new Error('Reducer "'+e+"\" returned undefined when probed with a random type. Don't try to handle "+s.ActionTypes.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.')})}function a(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++){var a=e[r];"function"==typeof t[a]&&(n[a]=t[a])}var s,u=Object.keys(n);try{i(n)}catch(t){s=t}return function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=arguments[1];if(s)throw s;for(var r=!1,i={},a=0;a<u.length;a++){var c=u[a],l=n[c],f=t[c],p=l(f,e);if(void 0===p){var d=o(c,e);throw new Error(d)}i[c]=p,r=r||p!==f}return r?i:t}}n.__esModule=!0,n.default=a;var s=t("./createStore"),u=t("lodash/isPlainObject"),c=(r(u),t("./utils/warning"));r(c)},{"./createStore":501,"./utils/warning":503,"lodash/isPlainObject":453}],500:[function(t,e,n){"use strict";function r(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)return function(t){return t};if(1===e.length)return e[0];var r=e[e.length-1],o=e.slice(0,-1);return function(){return o.reduceRight(function(t,e){return e(t)},r.apply(void 0,arguments))}}n.__esModule=!0,n.default=r},{}],501:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){function r(){v===g&&(v=g.slice())}function i(){return m}function s(t){if("function"!=typeof t)throw new Error("Expected listener to be a function.");var e=!0;return r(),v.push(t),function(){if(e){e=!1,r();var n=v.indexOf(t);v.splice(n,1)}}}function l(t){if(!(0,a.default)(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(b)throw new Error("Reducers may not dispatch actions.");try{b=!0,m=h(m,t)}finally{b=!1}for(var e=g=v,n=0;n<e.length;n++)e[n]();return t}function f(t){if("function"!=typeof t)throw new Error("Expected the nextReducer to be a function.");h=t,l({type:c.INIT})}function p(){var t,e=s;return t={subscribe:function(t){function n(){t.next&&t.next(i())}if("object"!=typeof t)throw new TypeError("Expected the observer to be an object.");return n(),{unsubscribe:e(n)}}},t[u.default]=function(){return this},t}var d;if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(o)(t,e)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var h=t,m=e,g=[],v=g,b=!1;return l({type:c.INIT}),d={dispatch:l,subscribe:s,getState:i,replaceReducer:f},d[u.default]=p,d}n.__esModule=!0,n.ActionTypes=void 0,n.default=o;var i=t("lodash/isPlainObject"),a=r(i),s=t("symbol-observable"),u=r(s),c=n.ActionTypes={INIT:"@@redux/INIT"}},{"lodash/isPlainObject":453,"symbol-observable":508}],502:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0,n.compose=n.applyMiddleware=n.bindActionCreators=n.combineReducers=n.createStore=void 0;var o=t("./createStore"),i=r(o),a=t("./combineReducers"),s=r(a),u=t("./bindActionCreators"),c=r(u),l=t("./applyMiddleware"),f=r(l),p=t("./compose"),d=r(p),h=t("./utils/warning");r(h);n.createStore=i.default,n.combineReducers=s.default,n.bindActionCreators=c.default,n.applyMiddleware=f.default,n.compose=d.default},{"./applyMiddleware":497,"./bindActionCreators":498,"./combineReducers":499,"./compose":500,"./createStore":501,"./utils/warning":503}],503:[function(t,e,n){"use strict";function r(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw new Error(t)}catch(t){}}n.__esModule=!0,n.default=r},{}],504:[function(t,e,n){(function(t){!function(t){"use strict";function n(t,e,n,r){var i=e&&e.prototype instanceof o?e:o,a=Object.create(i.prototype),s=new d(r||[]);return a._invoke=c(t,n,s),a}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function o(){}function i(){}function a(){}function s(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function u(e){function n(t,o,i,a){var s=r(e[t],e,o);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&b.call(c,"__await")?Promise.resolve(c.__await).then(function(t){n("next",t,i,a)},function(t){n("throw",t,i,a)}):Promise.resolve(c).then(function(t){u.value=t,i(u)},a)}a(s.arg)}function o(t,e){function r(){return new Promise(function(r,o){n(t,e,r,o)})}return i=i?i.then(r,r):r()}"object"==typeof t.process&&t.process.domain&&(n=t.process.domain.bind(n));var i;this._invoke=o}function c(t,e,n){var o=A;return function(i,a){if(o===j)throw new Error("Generator is already running");if(o===P){if("throw"===i)throw a;return m()}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=l(s,n);if(u){if(u===T)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===A)throw o=P,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=j;var c=r(t,e,n);if("normal"===c.type){if(o=n.done?P:E,c.arg===T)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=P,n.method="throw",n.arg=c.arg)}}}function l(t,e){var n=t.iterator[e.method];if(n===g){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=g,l(t,e),"throw"===e.method))return T;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,T;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=g),e.delegate=null,T):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,T)}function f(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function p(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function d(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(f,this),this.reset(!0)}function h(t){if(t){var e=t[_];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(b.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=g,e.done=!0,e};return r.next=r}}return{next:m}}function m(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,y="function"==typeof Symbol?Symbol:{},_=y.iterator||"@@iterator",x=y.asyncIterator||"@@asyncIterator",w=y.toStringTag||"@@toStringTag",S="object"==typeof e,O=t.regeneratorRuntime;if(O)return void(S&&(e.exports=O));O=t.regeneratorRuntime=S?e.exports:{},O.wrap=n;var A="suspendedStart",E="suspendedYield",j="executing",P="completed",T={},C={};C[_]=function(){return this};var R=Object.getPrototypeOf,N=R&&R(R(h([])));N&&N!==v&&b.call(N,_)&&(C=N);var k=a.prototype=o.prototype=Object.create(C);i.prototype=k.constructor=a,a.constructor=i,a[w]=i.displayName="GeneratorFunction",O.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===i||"GeneratorFunction"===(e.displayName||e.name))},O.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,w in t||(t[w]="GeneratorFunction")),t.prototype=Object.create(k),t},O.awrap=function(t){return{__await:t}},s(u.prototype),u.prototype[x]=function(){return this},O.AsyncIterator=u,O.async=function(t,e,r,o){var i=new u(n(t,e,r,o));return O.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},s(k),k[w]="Generator",k[_]=function(){return this},k.toString=function(){return"[object Generator]"},O.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},O.values=h,d.prototype={constructor:d,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(p),!t)for(var e in this)"t"===e.charAt(0)&&b.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=g)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return i.type="throw",i.arg=t,n.next=e,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(a&&s){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),T},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),p(n),T}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;p(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:h(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=g),T}}}("object"==typeof t?t:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],505:[function(t,e,n){"use strict";function r(t,e){return t===e}function o(t,e,n){if(null===e||null===n||e.length!==n.length)return!1;for(var r=e.length,o=0;o<r;o++)if(!t(e[o],n[o]))return!1;return!0}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=null,i=null;return function(){return o(e,n,arguments)||(i=t.apply(null,arguments)),n=arguments,i}}function a(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(t){return"function"==typeof t})){var n=e.map(function(t){return typeof t}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return e}function s(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return function(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];var s=0,u=r.pop(),c=a(r),l=t.apply(void 0,[function(){return s++,u.apply(null,arguments)}].concat(n)),f=i(function(){for(var t=[],e=c.length,n=0;n<e;n++)t.push(c[n].apply(null,arguments));return l.apply(null,t)});return f.resultFunc=u,f.recomputations=function(){return s},f.resetRecomputations=function(){return s=0},f}}function u(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;if("object"!=typeof t)throw new Error("createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof t);var n=Object.keys(t);return e(n.map(function(e){return t[e]}),function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.reduce(function(t,e,r){return t[n[r]]=e,t},{})})}n.__esModule=!0,n.defaultMemoize=i,n.createSelectorCreator=s,n.createStructuredSelector=u;var c=n.createSelector=s(i)},{}],506:[function(t,e,n){"use strict";e.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}},{}],507:[function(t,e,n){function r(t,e,n){this.f=t,this.once=e,this.priority=n}function o(){this.handlers=[]}function i(t,e){for(var n=0;n<t.handlers.length&&!(t.handlers[n].priority<e.priority);n++);t.handlers=t.handlers.slice(0,n).concat(e).concat(t.handlers.slice(n))}function a(){o.call(this)}function s(){o.call(this)}function u(){o.call(this)}n.Subscription=o,o.prototype.handlersForDispatch=function(){for(var t=this.handlers,e=null,n=t.length-1;n>=0;n--)t[n].once&&(e||(e=t.slice()),e.splice(n,1));return e&&(this.handlers=e),t},o.prototype.add=function(t,e){i(this,new r(t,!1,e||0))},o.prototype.addOnce=function(t,e){i(this,new r(t,!0,e||0))},o.prototype.remove=function(t){for(var e=0;e<this.handlers.length;e++)if(this.handlers[e].f==t)return void(this.handlers=this.handlers.slice(0,e).concat(this.handlers.slice(e+1)))},o.prototype.hasHandler=function(){return this.handlers.length>0},o.prototype.dispatch=function(){for(var t=this.handlersForDispatch(),e=0;e<t.length;e++)t[e].f.apply(null,arguments)},n.PipelineSubscription=a,a.prototype=new o,a.prototype.dispatch=function(t){for(var e=this.handlersForDispatch(),n=0;n<e.length;n++)t=e[n].f(t);return t},n.StoppableSubscription=s,s.prototype=new o,s.prototype.dispatch=function(){for(var t=this.handlersForDispatch(),e=0;e<t.length;e++){var n=t[e].f.apply(null,arguments);if(n)return n}},n.DOMSubscription=u,u.prototype=new o,u.prototype.dispatch=function(t){for(var e=this.handlersForDispatch(),n=0;n<e.length;n++)if(e[n].f(t)||t.defaultPrevented)return!0;return!1}},{}],508:[function(t,e,n){e.exports=t("./lib/index")},{"./lib/index":509}],509:[function(t,e,n){(function(r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o,i=t("./ponyfill"),a=function(t){return t&&t.__esModule?t:{default:t}}(i);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:void 0!==e?e:Function("return this")();var s=(0,a.default)(o);n.default=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ponyfill":510}],510:[function(t,e,n){"use strict";function r(t){var e,n=t.Symbol;return"function"==typeof n?n.observable?e=n.observable:(e=n("observable"),n.observable=e):e="@@observable",e}Object.defineProperty(n,"__esModule",{value:!0}),n.default=r},{}],511:[function(t,e,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(t,e,n){if(t&&c.isObject(t)&&t instanceof r)return t;var o=new r;return o.parse(t,e,n),o}function i(t){return c.isString(t)&&(t=o(t)),t instanceof r?t.format():r.prototype.format.call(t)}function a(t,e){return o(t,!1,!0).resolve(e)}function s(t,e){return t?o(t,!1,!0).resolveObject(e):e}var u=t("punycode"),c=t("./util");n.parse=o,n.resolve=a,n.resolveObject=s,n.format=i,n.Url=r;var l=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],h=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(h),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],b=/^[+a-z0-9A-Z_-]{0,63}$/,y=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},S=t("querystring");r.prototype.parse=function(t,e,n){if(!c.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=-1!==r&&r<t.indexOf("#")?"?":"#",i=t.split(o),a=/\\/g;i[0]=i[0].replace(a,"/"),t=i.join(o);var s=t;if(s=s.trim(),!n&&1===t.split("#").length){var f=p.exec(s);if(f)return this.path=s,this.href=s,this.pathname=f[1],f[2]?(this.search=f[2],this.query=e?S.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var d=l.exec(s);if(d){d=d[0];var h=d.toLowerCase();this.protocol=h,s=s.substr(d.length)}if(n||d||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var O="//"===s.substr(0,2);!O||d&&x[d]||(s=s.substr(2),this.slashes=!0)}if(!x[d]&&(O||d&&!w[d])){for(var A=-1,E=0;E<v.length;E++){var j=s.indexOf(v[E]);-1!==j&&(-1===A||j<A)&&(A=j)}var P,T;T=-1===A?s.lastIndexOf("@"):s.lastIndexOf("@",A),-1!==T&&(P=s.slice(0,T),s=s.slice(T+1),this.auth=decodeURIComponent(P)),A=-1;for(var E=0;E<g.length;E++){var j=s.indexOf(g[E]);-1!==j&&(-1===A||j<A)&&(A=j)}-1===A&&(A=s.length),this.host=s.slice(0,A),s=s.slice(A),this.parseHost(),this.hostname=this.hostname||"";var C="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!C)for(var R=this.hostname.split(/\./),E=0,N=R.length;E<N;E++){var k=R[E];if(k&&!k.match(b)){for(var I="",B=0,M=k.length;B<M;B++)k.charCodeAt(B)>127?I+="x":I+=k[B];if(!I.match(b)){var L=R.slice(0,E),D=R.slice(E+1),F=k.match(y);F&&(L.push(F[1]),D.unshift(F[2])),D.length&&(s="/"+D.join(".")+s),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=u.toASCII(this.hostname));var G=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+G,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[h])for(var E=0,N=m.length;E<N;E++){var U=m[E];if(-1!==s.indexOf(U)){var W=encodeURIComponent(U);W===U&&(W=escape(U)),s=s.split(U).join(W)}}var H=s.indexOf("#");-1!==H&&(this.hash=s.substr(H),s=s.slice(0,H));var V=s.indexOf("?");if(-1!==V?(this.search=s.substr(V),this.query=s.substr(V+1),e&&(this.query=S.parse(this.query)),s=s.slice(0,V)):e&&(this.search="",this.query={}),s&&(this.pathname=s),w[h]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var G=this.pathname||"",q=this.search||"";this.path=G+q}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,i="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(i=S.stringify(this.query));var a=this.search||i&&"?"+i||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||w[e])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),e+o+n+a+r},r.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if(c.isString(t)){var e=new r;e.parse(t,!1,!0),t=e}for(var n=new r,o=Object.keys(this),i=0;i<o.length;i++){var a=o[i];n[a]=this[a]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var s=Object.keys(t),u=0;u<s.length;u++){var l=s[u];"protocol"!==l&&(n[l]=t[l])}return w[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!w[t.protocol]){for(var f=Object.keys(t),p=0;p<f.length;p++){var d=f[p];n[d]=t[d]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||x[t.protocol])n.pathname=t.pathname;else{
for(var h=(t.pathname||"").split("/");h.length&&!(t.host=h.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),n.pathname=h.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var m=n.pathname||"",g=n.search||"";n.path=m+g}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var v=n.pathname&&"/"===n.pathname.charAt(0),b=t.host||t.pathname&&"/"===t.pathname.charAt(0),y=b||v||n.host&&t.pathname,_=y,S=n.pathname&&n.pathname.split("/")||[],h=t.pathname&&t.pathname.split("/")||[],O=n.protocol&&!w[n.protocol];if(O&&(n.hostname="",n.port=null,n.host&&(""===S[0]?S[0]=n.host:S.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===h[0]?h[0]=t.host:h.unshift(t.host)),t.host=null),y=y&&(""===h[0]||""===S[0])),b)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,S=h;else if(h.length)S||(S=[]),S.pop(),S=S.concat(h),n.search=t.search,n.query=t.query;else if(!c.isNullOrUndefined(t.search)){if(O){n.hostname=n.host=S.shift();var A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return n.search=t.search,n.query=t.query,c.isNull(n.pathname)&&c.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var E=S.slice(-1)[0],j=(n.host||t.host||S.length>1)&&("."===E||".."===E)||""===E,P=0,T=S.length;T>=0;T--)E=S[T],"."===E?S.splice(T,1):".."===E?(S.splice(T,1),P++):P&&(S.splice(T,1),P--);if(!y&&!_)for(;P--;P)S.unshift("..");!y||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),j&&"/"!==S.join("/").substr(-1)&&S.push("");var C=""===S[0]||S[0]&&"/"===S[0].charAt(0);if(O){n.hostname=n.host=C?"":S.length?S.shift():"";var A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return y=y||n.host&&S.length,y&&!C&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),c.isNull(n.pathname)&&c.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=f.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":512,punycode:490,querystring:494}],512:[function(t,e,n){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],513:[function(t,e,n){function r(t){var e=(!s||!t.ctrlKey&&!t.altKey&&!t.metaKey)&&t.key||(t.shiftKey?i:o)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}for(var o={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},i={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:";",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},a="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),s=a&&+a[1]<57,u=0;u<10;u++)o[48+u]=o[96+u]=String(u);for(var u=1;u<=24;u++)o[u+111]="F"+u;for(var u=65;u<=90;u++)o[u]=String.fromCharCode(u+32),i[u]=String.fromCharCode(u);for(var c in o)i.hasOwnProperty(c)||(i[c]=o[c]);e.exports=r,r.base=o,r.shift=i},{}],514:[function(t,e,n){!function(t){"use strict";function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function n(t){return"string"!=typeof t&&(t=String(t)),t}function r(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return v.iterable&&(e[Symbol.iterator]=function(){return e}),e}function o(t){this.map={},t instanceof o?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function i(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function a(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function s(t){var e=new FileReader,n=a(e);return e.readAsArrayBuffer(t),n}function u(t){var e=new FileReader,n=a(e);return e.readAsText(t),n}function c(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}function l(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(v.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(v.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(v.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(v.arrayBuffer&&v.blob&&y(t))this._bodyArrayBuffer=l(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!v.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!_(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=l(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):v.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},v.blob&&(this.blob=function(){var t=i(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?i(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(s)}),this.text=function(){var t=i(this);if(t)return t;if(this._bodyBlob)return u(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(c(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},v.formData&&(this.formData=function(){return this.text().then(h)}),this.json=function(){return this.text().then(JSON.parse)},this}function p(t){var e=t.toUpperCase();return x.indexOf(e)>-1?e:t}function d(t,e){e=e||{};var n=e.body;if(t instanceof d){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new o(t.headers)),this.method=t.method,this.mode=t.mode,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new o(e.headers)),this.method=p(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function h(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(o))}}),e}function m(t){var e=new o;return t.split(/\r?\n/).forEach(function(t){var n=t.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();e.append(r,o)}}),e}function g(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new o(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var v={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(v.arrayBuffer)var b=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],y=function(t){return t&&DataView.prototype.isPrototypeOf(t)},_=ArrayBuffer.isView||function(t){return t&&b.indexOf(Object.prototype.toString.call(t))>-1};o.prototype.append=function(t,r){t=e(t),r=n(r);var o=this.map[t];this.map[t]=o?o+","+r:r},o.prototype.delete=function(t){delete this.map[e(t)]},o.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},o.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},o.prototype.set=function(t,r){this.map[e(t)]=n(r)},o.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},o.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),r(t)},o.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),r(t)},o.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),r(t)},v.iterable&&(o.prototype[Symbol.iterator]=o.prototype.entries);var x=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];d.prototype.clone=function(){return new d(this,{body:this._bodyInit})},f.call(d.prototype),f.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new o(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];g.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},t.Headers=o,t.Request=d,t.Response=g,t.fetch=function(t,e){return new Promise(function(n,r){var o=new d(t,e),i=new XMLHttpRequest;i.onload=function(){var t={status:i.status,statusText:i.statusText,headers:m(i.getAllResponseHeaders()||"")};t.url="responseURL"in i?i.responseURL:t.headers.get("X-Request-URL");var e="response"in i?i.response:i.responseText;n(new g(e,t))},i.onerror=function(){r(new TypeError("Network request failed"))},i.ontimeout=function(){r(new TypeError("Network request failed"))},i.open(o.method,o.url,!0),"include"===o.credentials&&(i.withCredentials=!0),"responseType"in i&&v.blob&&(i.responseType="blob"),o.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),i.send(void 0===o._bodyInit?null:o._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},{}],515:[function(t,e,n){"use strict";function r(t,e,n,r){return new Promise(function(o,i){function a(){t().then(function(t){try{e(t)?o(t):setTimeout(a,n)}catch(t){i(t)}},function(t){return i(t)})}setTimeout(a,r||0)})}function o(t,e){return t.replace(/:(\w+)/g,function(t,n){return e[n]})}function i(t,e){function n(t,e,n,r){return n&&"GET"===t&&(e=o(e,n)),fetch(a+e,{method:t,headers:Object.assign({Accept:"application/json"},r),body:"GET"!==t?n:void 0,credentials:"same-origin"}).then(function(t){return t.json().then(function(e){return t.ok?e:Promise.reject(e.error)})}).catch(function(t){throw"Cannot parse result\n"+t})}function i(t,r,o){return function(i,a){var u=Object.assign({},o,i);return u.options=Object.assign(u.options||{},e,a),s.then(function(){return n(t,r,JSON.stringify(u),{"Content-Type":"application/json"})})}}var a=!t||/\/$/.test(t)?t:t+"/",s=n("GET","indigo/info").then(function(t){return{indigoVersion:t.Indigo.version}}).catch(function(){throw Error("Server is not compatible")});return Object.assign(s,{convert:i("POST","indigo/convert"),layout:i("POST","indigo/layout"),clean:i("POST","indigo/clean"),aromatize:i("POST","indigo/aromatize"),dearomatize:i("POST","indigo/dearomatize"),calculateCip:i("POST","indigo/calculate_cip"),automap:i("POST","indigo/automap"),check:i("POST","indigo/check"),calculate:i("POST","indigo/calculate"),recognize:function(t){var e=n("POST","imago/uploads",t,{"Content-Type":t.type||"application/octet-stream"}),o=n.bind(null,"GET","imago/uploads/:id");return e.then(function(t){return r(o.bind(null,{id:t.upload_id}),function(t){if("FAILURE"===t.state)throw t;return"SUCCESS"===t.state},500,300)}).then(function(t){return{struct:t.metadata.mol_str}})}})}Object.defineProperty(n,"__esModule",{value:!0}),n.default=i},{}],516:[function(t,e,n){"use strict";var r=[null,{label:"H",period:1,group:1,color:"#000000",title:"Hydrogen",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:1.00794},{label:"He",period:1,group:8,color:"#d9ffff",title:"Helium",state:"gas",origin:"primordial",type:"noble",atomic_mass:4.0026022},{label:"Li",period:2,group:1,color:"#cc80ff",title:"Lithium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:6.94},{label:"Be",period:2,group:2,color:"#c2ff00",title:"Beryllium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:9.01218315},{label:"B",period:2,group:3,color:"#ffb5b5",title:"Boron",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:10.81},{label:"C",period:2,group:4,title:"Carbon",state:"solid",origin:"primordial",type:"polyatomic",atomic_mass:12.011},{label:"N",period:2,group:5,color:"#304ff7",title:"Nitrogen",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:14.007},{label:"O",period:2,group:6,leftH:!0,color:"#ff0d0d",title:"Oxygen",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:15.999},{label:"F",period:2,group:7,leftH:!0,color:"#8fe04f",title:"Fluorine",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:18.9984031636},{label:"Ne",period:2,group:8,color:"#b3e3f5",title:"Neon",state:"gas",origin:"primordial",type:"noble",atomic_mass:20.17976},{label:"Na",period:3,group:1,color:"#ab5cf2",title:"Sodium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:22.989769282},{label:"Mg",period:3,group:2,color:"#8aff00",title:"Magnesium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:24.305},{label:"Al",period:3,group:3,color:"#bfa6a6",title:"Aluminium",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:26.98153857},{label:"Si",period:3,group:4,color:"#f0c7a1",title:"Silicon",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:28.085},{label:"P",period:3,group:5,color:"#ff8000",title:"Phosphorus",state:"solid",origin:"primordial",type:"polyatomic",atomic_mass:30.9737619985},{label:"S",period:3,group:6,leftH:!0,color:"#d9a61a",title:"Sulfur",state:"solid",origin:"primordial",type:"polyatomic",atomic_mass:32.06},{label:"Cl",period:3,group:7,leftH:!0,color:"#1fd01f",title:"Chlorine",state:"gas",origin:"primordial",type:"diatomic",atomic_mass:35.45},{label:"Ar",period:3,group:8,color:"#80d1e3",title:"Argon",state:"gas",origin:"primordial",type:"noble",atomic_mass:39.9481},{label:"K",period:4,group:1,color:"#8f40d4",title:"Potassium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:39.09831},{label:"Ca",period:4,group:2,color:"#3dff00",title:"Calcium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:40.0784},{label:"Sc",period:4,group:3,color:"#e6e6e6",title:"Scandium",state:"solid",origin:"primordial",type:"transition",atomic_mass:44.9559085},{label:"Ti",period:4,group:4,color:"#bfc2c7",title:"Titanium",state:"solid",origin:"primordial",type:"transition",atomic_mass:47.8671},{label:"V",period:4,group:5,color:"#a6a6ab",title:"Vanadium",state:"solid",origin:"primordial",type:"transition",atomic_mass:50.94151},{label:"Cr",period:4,group:6,color:"#8a99c7",title:"Chromium",state:"solid",origin:"primordial",type:"transition",atomic_mass:51.99616},{label:"Mn",period:4,group:7,color:"#9c7ac7",title:"Manganese",state:"solid",origin:"primordial",type:"transition",atomic_mass:54.9380443},{label:"Fe",period:4,group:8,color:"#e06633",title:"Iron",state:"solid",origin:"primordial",type:"transition",atomic_mass:55.8452},{label:"Co",period:4,group:8,color:"#f08fa1",title:"Cobalt",state:"solid",origin:"primordial",type:"transition",atomic_mass:58.9331944},{label:"Ni",period:4,group:8,color:"#4fd14f",title:"Nickel",state:"solid",origin:"primordial",type:"transition",atomic_mass:58.69344},{label:"Cu",period:4,group:1,color:"#c78033",title:"Copper",state:"solid",origin:"primordial",type:"transition",atomic_mass:63.5463},{label:"Zn",period:4,group:2,color:"#7d80b0",title:"Zinc",state:"solid",origin:"primordial",type:"transition",atomic_mass:65.382},{label:"Ga",period:4,group:3,color:"#c28f8f",title:"Gallium",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:69.7231},{label:"Ge",period:4,group:4,color:"#668f8f",title:"Germanium",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:72.6308},{label:"As",period:4,group:5,color:"#bd80e3",title:"Arsenic",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:74.9215956},{label:"Se",period:4,group:6,leftH:!0,color:"#ffa100",title:"Selenium",state:"solid",origin:"primordial",type:"polyatomic",atomic_mass:78.9718},{label:"Br",period:4,group:7,leftH:!0,color:"#a62929",title:"Bromine",state:"liquid",origin:"primordial",type:"diatomic",atomic_mass:79.904},{label:"Kr",period:4,group:8,color:"#5cb8d1",title:"Krypton",state:"gas",origin:"primordial",type:"noble",atomic_mass:83.7982},{label:"Rb",period:5,group:1,color:"#702eb0",title:"Rubidium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:85.46783},{label:"Sr",period:5,group:2,color:"#00ff00",title:"Strontium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:87.621},{label:"Y",period:5,group:3,color:"#94ffff",title:"Yttrium",state:"solid",origin:"primordial",type:"transition",atomic_mass:88.905842},{label:"Zr",period:5,group:4,color:"#94e0e0",title:"Zirconium",state:"solid",origin:"primordial",type:"transition",atomic_mass:91.2242},{label:"Nb",period:5,group:5,color:"#73c2c9",title:"Niobium",state:"solid",origin:"primordial",type:"transition",atomic_mass:92.906372},{label:"Mo",period:5,group:6,color:"#54b5b5",title:"Molybdenum",state:"solid",origin:"primordial",type:"transition",atomic_mass:95.951},{label:"Tc",period:5,group:7,color:"#3b9e9e",title:"Technetium",state:"solid",origin:"decay",type:"transition",atomic_mass:98},{label:"Ru",period:5,group:8,color:"#248f8f",title:"Ruthenium",state:"solid",origin:"primordial",type:"transition",atomic_mass:101.072},{label:"Rh",period:5,group:8,color:"#0a7d8c",title:"Rhodium",state:"solid",origin:"primordial",type:"transition",atomic_mass:102.905502},{label:"Pd",period:5,group:8,color:"#006985",title:"Palladium",state:"solid",origin:"primordial",type:"transition",atomic_mass:106.421},{label:"Ag",period:5,group:1,color:"#bfbfbf",title:"Silver",state:"solid",origin:"primordial",type:"transition",atomic_mass:107.86822},{label:"Cd",period:5,group:2,color:"#ffd98f",title:"Cadmium",state:"solid",origin:"primordial",type:"transition",atomic_mass:112.4144},{label:"In",period:5,group:3,color:"#a67573",title:"Indium",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:114.8181},{label:"Sn",period:5,group:4,color:"#668080",title:"Tin",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:118.7107},{label:"Sb",period:5,group:5,color:"#9e63b5",title:"Antimony",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:121.7601},{label:"Te",period:5,group:6,color:"#d47a00",title:"Tellurium",state:"solid",origin:"primordial",type:"metalloid",atomic_mass:127.603},{label:"I",period:5,group:7,leftH:!0,color:"#940094",title:"Iodine",state:"solid",origin:"primordial",type:"diatomic",atomic_mass:126.904473},{label:"Xe",period:5,group:8,color:"#429eb0",title:"Xenon",state:"gas",origin:"primordial",type:"noble",atomic_mass:131.2936},{label:"Cs",period:6,group:1,color:"#57178f",title:"Caesium",state:"solid",origin:"primordial",type:"alkali",atomic_mass:132.905451966},{label:"Ba",period:6,group:2,color:"#00c900",title:"Barium",state:"solid",origin:"primordial",type:"alkaline-earth",atomic_mass:137.3277},{label:"La",period:6,group:3,color:"#70d4ff",title:"Lanthanum",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:138.905477},{label:"Ce",period:6,group:3,color:"#ffffc7",title:"Cerium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:140.1161},{label:"Pr",period:6,group:3,color:"#d9ffc7",title:"Praseodymium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:140.907662},{label:"Nd",period:6,group:3,color:"#c7ffc7",title:"Neodymium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:144.2423},{label:"Pm",period:6,group:3,color:"#a3ffc7",title:"Promethium",state:"solid",origin:"decay",type:"lanthanide",atomic_mass:145},{label:"Sm",period:6,group:3,color:"#8fffc7",title:"Samarium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:150.362},{label:"Eu",period:6,group:3,color:"#61ffc7",title:"Europium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:151.9641},{label:"Gd",period:6,group:3,color:"#45ffc7",title:"Gadolinium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:157.253},{label:"Tb",period:6,group:3,color:"#30ffc7",title:"Terbium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:158.925352},{label:"Dy",period:6,group:3,color:"#1fffc7",title:"Dysprosium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:162.5001},{label:"Ho",period:6,group:3,color:"#00ff9c",title:"Holmium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:164.930332},{label:"Er",period:6,group:3,color:"#00e675",title:"Erbium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:167.2593},{label:"Tm",period:6,group:3,color:"#00d452",title:"Thulium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:168.934222},{label:"Yb",period:6,group:3,color:"#00bf38",title:"Ytterbium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:173.0451},{label:"Lu",period:6,group:3,color:"#00ab24",title:"Lutetium",state:"solid",origin:"primordial",type:"lanthanide",atomic_mass:174.96681},{label:"Hf",period:6,group:4,color:"#4dc2ff",title:"Hafnium",state:"solid",origin:"primordial",type:"transition",atomic_mass:178.492},{label:"Ta",period:6,group:5,color:"#4da6ff",title:"Tantalum",state:"solid",origin:"primordial",type:"transition",atomic_mass:180.947882},{label:"W",period:6,group:6,color:"#2194d6",title:"Tungsten",state:"solid",origin:"primordial",type:"transition",atomic_mass:183.841},{label:"Re",period:6,group:7,color:"#267dab",title:"Rhenium",state:"solid",origin:"primordial",type:"transition",atomic_mass:186.2071},{label:"Os",period:6,group:8,color:"#266696",title:"Osmium",state:"solid",origin:"primordial",type:"transition",atomic_mass:190.233},{label:"Ir",period:6,group:8,color:"#175487",title:"Iridium",state:"solid",origin:"primordial",type:"transition",atomic_mass:192.2173},{label:"Pt",period:6,group:8,color:"#d1d1e0",title:"Platinum",state:"solid",origin:"primordial",type:"transition",atomic_mass:195.0849},{label:"Au",period:6,group:1,color:"#ffd124",title:"Gold",state:"solid",origin:"primordial",type:"transition",atomic_mass:196.9665695},{label:"Hg",period:6,group:2,color:"#b8b8d1",title:"Mercury",state:"liquid",origin:"primordial",type:"transition",atomic_mass:200.5923},{label:"Tl",period:6,group:3,color:"#a6544d",title:"Thallium",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:204.38},{label:"Pb",period:6,group:4,color:"#575961",title:"Lead",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:207.21},{label:"Bi",period:6,group:5,color:"#9e4fb5",title:"Bismuth",state:"solid",origin:"primordial",type:"post-transition",atomic_mass:208.980401},{label:"Po",period:6,group:6,color:"#ab5c00",title:"Polonium",state:"solid",origin:"decay",type:"post-transition",atomic_mass:209},{label:"At",period:6,group:7,color:"#754f45",title:"Astatine",state:"solid",origin:"decay",type:"metalloid",atomic_mass:210},{label:"Rn",period:6,group:8,color:"#428296",title:"Radon",state:"gas",origin:"decay",type:"noble",atomic_mass:222},{label:"Fr",period:7,group:1,color:"#420066",title:"Francium",state:"solid",origin:"decay",type:"alkali",atomic_mass:223},{label:"Ra",period:7,group:2,color:"#007d00",title:"Radium",state:"solid",origin:"decay",type:"alkaline-earth",atomic_mass:226},{label:"Ac",period:7,group:3,color:"#70abfa",title:"Actinium",state:"solid",origin:"decay",type:"actinide",atomic_mass:227},{label:"Th",period:7,group:3,color:"#00baff",title:"Thorium",state:"solid",origin:"primordial",type:"actinide",atomic_mass:232.03774},{label:"Pa",period:7,group:3,color:"#00a1ff",title:"Protactinium",state:"solid",origin:"decay",type:"actinide",atomic_mass:231.035882},{label:"U",period:7,group:3,color:"#008fff",title:"Uranium",state:"solid",origin:"primordial",type:"actinide",atomic_mass:238.028913},{label:"Np",period:7,group:3,color:"#0080ff",title:"Neptunium",state:"solid",origin:"decay",type:"actinide",atomic_mass:237},{label:"Pu",period:7,group:3,color:"#006bff",title:"Plutonium",state:"solid",origin:"decay",type:"actinide",atomic_mass:244},{label:"Am",period:7,group:3,color:"#545cf2",title:"Americium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:243},{label:"Cm",period:7,group:3,color:"#785ce3",title:"Curium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:247},{label:"Bk",period:7,group:3,color:"#8a4fe3",title:"Berkelium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:247},{label:"Cf",period:7,group:3,color:"#a136d4",title:"Californium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:251},{label:"Es",period:7,group:3,color:"#b31fd4",title:"Einsteinium",state:"solid",origin:"synthetic",type:"actinide",atomic_mass:252},{label:"Fm",period:7,group:3,title:"Fermium",origin:"synthetic",type:"actinide",atomic_mass:257},{label:"Md",period:7,group:3,title:"Mendelevium",origin:"synthetic",type:"actinide",atomic_mass:258},{label:"No",period:7,group:3,title:"Nobelium",origin:"synthetic",type:"actinide",atomic_mass:259},{label:"Lr",period:7,group:3,title:"Lawrencium",origin:"synthetic",type:"actinide",atomic_mass:266},{label:"Rf",period:7,group:4,color:"#4dc2ff",title:"Rutherfordium",origin:"synthetic",type:"transition",atomic_mass:267},{label:"Db",period:7,group:5,color:"#4da6ff",title:"Dubnium",origin:"synthetic",type:"transition",atomic_mass:268},{label:"Sg",period:7,group:6,color:"#2194d6",title:"Seaborgium",origin:"synthetic",type:"transition",atomic_mass:269},{label:"Bh",period:7,group:7,color:"#267dab",title:"Bohrium",origin:"synthetic",type:"transition",atomic_mass:270},{label:"Hs",period:7,group:8,color:"#266696",title:"Hassium",origin:"synthetic",type:"transition",atomic_mass:269},{label:"Mt",period:7,group:8,color:"#175487",title:"Meitnerium",origin:"synthetic",atomic_mass:278},{label:"Ds",period:7,group:8,color:"#d1d1e0",title:"Darmstadtium",origin:"synthetic",atomic_mass:281},{label:"Rg",period:7,group:1,color:"#ffd124",title:"Roentgenium",origin:"synthetic",atomic_mass:282},{label:"Cn",period:7,group:2,color:"#b8b8d1",title:"Copernicium",origin:"synthetic",type:"transition",atomic_mass:285},{label:"Nh",period:7,group:3,title:"Nihonium",origin:"synthetic",atomic_mass:286},{label:"Fl",period:7,group:4,title:"Flerovium",origin:"synthetic",type:"post-transition",atomic_mass:289},{label:"Mc",period:7,group:5,title:"Moscovium",origin:"synthetic",atomic_mass:289},{label:"Lv",period:7,group:6,title:"Livermorium",origin:"synthetic",atomic_mass:293},{label:"Ts",period:7,group:7,title:"Tennessine",origin:"synthetic",atomic_mass:294},{label:"Og",period:7,group:8,title:"Oganesson",origin:"synthetic",atomic_mass:294}];r.map=r.reduce(function(t,e,n){return e&&(t[e.label]=n),t},{}),e.exports=r},{}],517:[function(t,e,n){"use strict";function r(t,e,n){return Object.keys(t).reduce(function(n,o){return"labels"===o?t.labels.reduce(function(t,n){return t[n]=e||!0,t},n):r(t[o],e?e.concat(o):[o],n)},n||{})}function o(t,e){return e.reduce(function(t,e){return t&&t[e]||null},t)}var i={atom:{any:{labels:["A","AH"]},"no-carbon":{labels:["Q","QH"]},metal:{labels:["M","MH"]},halogen:{labels:["X","XH"]}},group:{labels:["G","GH","G*","GH*"],acyclic:{labels:["ACY","ACH"],carbo:{labels:["ABC","ABH"],alkynyl:{labels:["AYL","AYH"]},alkyl:{labels:["ALK","ALH"]},alkenyl:{labels:["AEL","AEH"]}},hetero:{labels:["AHC","AHH"],alkoxy:{labels:["AOX","AOH"]}}},cyclic:{labels:["CYC","CYH"],"no-carbon":{labels:["CXX","CXH"]},carbo:{labels:["CBC","CBH"],aryl:{labels:["ARY","ARH"]},cycloalkyl:{labels:["CAL","CAH"]},cycloalkenyl:{labels:["CEL","CEH"]}},hetero:{labels:["CHC","CHH"],aryl:{labels:["HAR","HAH"]}}}},special:{labels:["H+","D","T","R","Pol"]}};i.map=r(i),i.map["*"]=i.map.A,i.get=function(t){return r(o(t))},e.exports=i},{}],518:[function(t,e,n){"use strict";function r(t){if(0==t[0].search("\\$MDL"))return _.parseRg2000(t);var e=o(t.slice(3));return e.name=t[0].trim(),e}function o(t){var e=b(t[0],S.fmtInfo.countsLinePartition),n=e[11].trim();if(t=t.slice(1),"V2000"==n)return _.parseCTabV2000(t,e);if("V3000"==n)return x.parseCTabV3000(t,!O);throw new Error("Molfile version unknown: "+n)}function i(t){var e=t[0].trim().split(" ");return e.length>1&&"V3000"==e[1]?x.parseRxn3000(t):_.parseRxn2000(t)}function a(t,e){var n=[];if(e.bonds.each(function(r,o){var i=e.atoms.get(o.begin),a=e.atoms.get(o.end);(y.contains(i.sgs,t.id)&&!y.contains(a.sgs,t.id)||y.contains(a.sgs,t.id)&&!y.contains(i.sgs,t.id))&&n.push(r)},t),0!=n.length&&2!=n.length)throw{id:t.id,"error-type":"cross-bond-number",message:"Unsupported cross-bonds number"};t.bonds=n}function s(t,e){var n=[];e.bonds.each(function(r,o){var i=e.atoms.get(o.begin),a=e.atoms.get(o.end);(y.contains(i.sgs,t.id)&&!y.contains(a.sgs,t.id)||y.contains(a.sgs,t.id)&&!y.contains(i.sgs,t.id))&&n.push(r)},t),t.bonds=n}function u(t,e){}function c(t,e){t.atoms=w.SGroup.getAtoms(e,t)}function l(t,e,n,r,o){var i=(n[t.id]+"").padStart(3),a=[];a=a.concat(m("SAL",i,Object.keys(t.atomSet),r)),a=a.concat(m("SPA",i,Object.keys(t.parentAtomSet),r)),a=a.concat(m("SBL",i,t.bonds,o));var s="M SMT "+i+" "+t.data.mul;return a.push(s),a=a.concat(g(e,t,i)),a.join("\n")}function f(t,e,n,r,o){var i=(n[t.id]+"").padStart(3),a=[];return a=a.concat(m("SAL",i,t.atoms,r)),a=a.concat(m("SBL",i,t.bonds,o)),a=a.concat(g(e,t,i)),a.join("\n")}function p(t,e,n,r,o){var i=(n[t.id]+"").padStart(3),a=[];return a=a.concat(m("SAL",i,t.atoms,r)),a=a.concat(m("SBL",i,t.bonds,o)),t.data.name&&""!=t.data.name&&a.push("M SMT "+i+" "+t.data.name),a.join("\n")}function d(t,e,n,r){var o=(n[t.id]+"").padStart(3),i=t.data,a=t.pp;i.absolute||(a=a.sub(w.SGroup.getMassCentre(e,t.atoms)));var s=[];s=s.concat(m("SAL",o,t.atoms,r));var u="M SDT "+o+" "+(i.fieldName||"").padEnd(30)+(i.fieldType||"").padStart(2)+(i.units||"").padEnd(20)+(i.query||"").padStart(2);i.queryOp&&(u+=i.queryOp.padEnd(15)),s.push(u);var c="M SDD "+o+" "+S.paddedNum(a.x,10,4)+S.paddedNum(-a.y,10,4)+" "+(i.attached?"A":"D")+(i.absolute?"A":"R")+(i.showUnits?"U":" ")+" "+(i.nCharnCharsToDisplay>=0?S.paddedNum(i.nCharnCharsToDisplay,3):"ALL")+" 1 "+(i.tagChar||" ")+" "+S.paddedNum(i.daspPos,1)+" ";s.push(c)
;var l=v(i.fieldValue).replace(/\n*$/,"");return l.split("\n").forEach(function(t){for(;t.length>69;)s.push("M SCD "+o+" "+t.slice(0,69)),t=t.slice(69);s.push("M SED "+o+" "+t)}),s.join("\n")}function h(t,e,n,r,o){var i=(n[t.id]+"").padStart(3),a=[];return a=a.concat(m("SAL",i,t.atoms,r)),a=a.concat(m("SBL",i,t.bonds,o)),a=a.concat(g(e,t,i)),a.join("\n")}function m(t,e,n,r){if(!n)return[];for(var o=[],i=0;i<Math.floor((n.length+14)/15);++i){for(var a=Math.min(n.length-15*i,15),s="M "+t+" "+e+" "+S.paddedNum(a,2),u=0;u<a;++u)s+=" "+S.paddedNum(r[n[15*i+u]],3);o.push(s)}return o}function g(t,e,n){var r=[],o=[],i=y.fromList(e.atoms);w.SGroup.getCrossBonds(r,o,t,i),w.SGroup.bracketPos(e,t,o);for(var a=e.bracketBox,s=e.bracketDir,u=s.rotateSC(1,0),c=w.SGroup.getBracketParameters(t,o,i,a,s,u),l=[],f=0;f<c.length;++f){for(var p=c[f],d=p.c.addScaled(p.n,-.5*p.h).yComplement(),h=p.c.addScaled(p.n,.5*p.h).yComplement(),m="M SDI "+n+S.paddedNum(4,3),g=[d.x,d.y,h.x,h.y],v=0;v<g.length;++v)m+=S.paddedNum(g[v],10,4);l.push(m)}return l}function v(t){return t.replace(j,"\n")}function b(t,e,n){for(var r=[],o=0,i=0;o<e.length;++o)r.push(t.slice(i,i+e[o])),n&&i++,i+=e[o];return r}var y=t("../../util/set"),_=t("./v2000"),x=t("./v3000"),w=t("./../struct/index"),S=t("./utils"),O=!0,A={MUL:w.SGroup.prepareMulForSaving,SRU:a,SUP:s,DAT:c,GEN:u},E={MUL:l,SRU:f,SUP:p,DAT:d,GEN:h},j=/\r\n|[\n\r]/g;e.exports={parseCTab:o,parseMol:r,parseRxn:i,prepareForSaving:A,saveToMolfile:E}},{"../../util/set":656,"./../struct/index":533,"./utils":522,"./v2000":523,"./v3000":524}],519:[function(t,e,n){"use strict";function r(t,e){var n=new o,r=t.split(/\r\n|[\n\r]/g);try{return n.parseCTFile(r)}catch(t){if(e.badHeaderRecover){try{return n.parseCTFile(r.slice(1))}catch(t){}try{return n.parseCTFile([""].concat(r))}catch(t){}}throw t}}var o=t("./molfile");e.exports={stringify:function(t,e){var n=e||{};return new o(n.v3000).saveMolecule(t,n.ignoreErrors,n.noRgroups,n.preserveIndigoDesc)},parse:function(t,e){return r(t,e||{})}}},{"./molfile":520}],520:[function(t,e,n){"use strict";function r(t){this.molecule=null,this.molfile=null,this.v3000=t||!1}var o=t("./../element"),i=t("./common"),a=t("./utils");r.prototype.parseCTFile=function(t){var e=null;return e=0==t[0].search("\\$RXN")?i.parseRxn(t):i.parseMol(t),e.initHalfBonds(),e.initNeighbors(),e.markFragments(),e},r.prototype.prepareSGroups=function(t,e){var n=this.molecule,r=[],o=0;if(this.molecule.sGroupForest.getSGroupsBFS().reverse().forEach(function(a){var s=n.sgroups.get(a),u=!1;try{i.prepareForSaving[s.type](s,n)}catch(e){if(!t||"number"!=typeof e.id)throw e;u=!0}(u||!e&&/^INDIGO_.+_DESC$/i.test(s.data.fieldName))&&(o+=u,r.push(s.id))},this),o)throw new Error("WARNING: "+o+" invalid S-groups were detected. They will be omitted.");for(var a=0;a<r.length;++a)n.sGroupDelete(r[a]);return n},r.prototype.getCTab=function(t,e){return this.molecule=t.clone(),this.molfile="",this.writeCTab2000(e),this.molfile},r.prototype.saveMolecule=function(t,e,n,o){if(this.reaction=t.rxnArrows.count()>0,t.rxnArrows.count()>1)throw new Error("Reaction may not contain more than one arrow");if(this.molfile=""+t.name,this.reaction){if(t.rgroups.count()>0)throw new Error("Unable to save the structure - reactions with r-groups are not supported at the moment");var i=t.getComponents(),s=i.reactants,u=i.products,c=s.concat(u);this.molfile="$RXN\n\n\n\n"+a.paddedNum(s.length,3)+a.paddedNum(u.length,3)+a.paddedNum(0,3)+"\n";for(var l=0;l<c.length;++l){var f=new r(!1),p=t.clone(c[l],null,!0),d=f.saveMolecule(p,!1,!0);this.molfile+="$MOL\n"+d}return this.molfile}if(t.rgroups.count()>0){if(!n){var h=new r(!1).getCTab(t.getScaffold(),t.rgroups);return this.molfile="$MDL REV 1\n$MOL\n$HDR\n\n\n\n$END HDR\n",this.molfile+="$CTAB\n"+h+"$END CTAB\n",t.rgroups.each(function(e,n){this.molfile+="$RGP\n",this.writePaddedNumber(e,3),this.molfile+="\n",n.frags.each(function(e,n){var o=new r(!1).getCTab(t.getFragment(n));this.molfile+="$CTAB\n"+o+"$END CTAB\n"},this),this.molfile+="$END RGP\n"},this),this.molfile+="$END MOL\n",this.molfile}t=t.getScaffold()}return this.molecule=t.clone(),this.prepareSGroups(e,o),this.writeHeader(),this.writeCTab2000(),this.molfile},r.prototype.writeHeader=function(){var t=new Date;this.writeCR(),this.writeWhiteSpace(2),this.write("Ketcher"),this.writeWhiteSpace(),this.writeCR((t.getMonth()+1+"").padStart(2)+(t.getDate()+"").padStart(2)+(t.getFullYear()%100+"").padStart(2)+(t.getHours()+"").padStart(2)+(t.getMinutes()+"").padStart(2)+"2D 1 1.00000 0.00000 0"),this.writeCR()},r.prototype.write=function(t){this.molfile+=t},r.prototype.writeCR=function(t){0==arguments.length&&(t=""),this.molfile+=t+"\n"},r.prototype.writeWhiteSpace=function(t){0==arguments.length&&(t=1),this.write(" ".repeat(Math.max(t,0)))},r.prototype.writePadded=function(t,e){this.write(t),this.writeWhiteSpace(e-t.length)},r.prototype.writePaddedNumber=function(t,e){var n=(t-0).toString();this.writeWhiteSpace(e-n.length),this.write(n)},r.prototype.writePaddedFloat=function(t,e,n){this.write(a.paddedNum(t,e,n))},r.prototype.writeCTab2000Header=function(){this.writePaddedNumber(this.molecule.atoms.count(),3),this.writePaddedNumber(this.molecule.bonds.count(),3),this.writePaddedNumber(0,3),this.writeWhiteSpace(3),this.writePaddedNumber(this.molecule.isChiral?1:0,3),this.writePaddedNumber(0,3),this.writeWhiteSpace(12),this.writePaddedNumber(999,3),this.writeCR(" V2000")},r.prototype.writeCTab2000=function(t){function e(t,e){for(;e.length>0;){for(var n=[];e.length>0&&n.length<8;)n.push(e[0]),e.splice(0,1);this.write(t),this.writePaddedNumber(n.length,3),n.forEach(function(t){this.writeWhiteSpace(),this.writePaddedNumber(this.mapping[t[0]],3),this.writeWhiteSpace(),this.writePaddedNumber(t[1],3)},this),this.writeCR()}}this.writeCTab2000Header(),this.mapping={};var n=1,r=[],s=[];for(this.molecule.atoms.each(function(t,e){this.writePaddedFloat(e.pp.x,10,4),this.writePaddedFloat(-e.pp.y,10,4),this.writePaddedFloat(e.pp.z,10,4),this.writeWhiteSpace();var i=e.label;null!=e.atomList?(i="L",r.push(t)):e.pseudo?e.pseudo.length>3&&(i="A",s.push({id:t,value:"'"+e.pseudo+"'"})):e.alias?s.push({id:t,value:e.alias}):o.map[i]||-1!=["A","Q","X","*","R#"].indexOf(i)||(i="C",s.push({id:t,value:e.label})),this.writePadded(i,3),this.writePaddedNumber(0,2),this.writePaddedNumber(0,3),this.writePaddedNumber(0,3),void 0===e.hCount&&(e.hCount=0),this.writePaddedNumber(e.hCount,3),void 0===e.stereoCare&&(e.stereoCare=0),this.writePaddedNumber(e.stereoCare,3),this.writePaddedNumber(e.explicitValence<0?0:0==e.explicitValence?15:e.explicitValence,3),this.writePaddedNumber(0,3),this.writePaddedNumber(0,3),this.writePaddedNumber(0,3),void 0===e.aam&&(e.aam=0),this.writePaddedNumber(e.aam,3),void 0===e.invRet&&(e.invRet=0),this.writePaddedNumber(e.invRet,3),void 0===e.exactChangeFlag&&(e.exactChangeFlag=0),this.writePaddedNumber(e.exactChangeFlag,3),this.writeCR(),this.mapping[t]=n,n++},this),this.bondMapping={},n=1,this.molecule.bonds.each(function(t,e){this.bondMapping[t]=n++,this.writePaddedNumber(this.mapping[e.begin],3),this.writePaddedNumber(this.mapping[e.end],3),this.writePaddedNumber(e.type,3),void 0===e.stereo&&(e.stereo=0),this.writePaddedNumber(e.stereo,3),this.writePadded(e.xxx,3),void 0===e.topology&&(e.topology=0),this.writePaddedNumber(e.topology,3),void 0===e.reactingCenterStatus&&(e.reactingCenterStatus=0),this.writePaddedNumber(e.reactingCenterStatus,3),this.writeCR()},this);s.length>0;)this.write("A "),this.writePaddedNumber(s[0].id+1,3),this.writeCR(),this.writeCR(s[0].value),s.splice(0,1);var u=[],c=[],l=[],f=[],p=[],d=[],h=[],m=[],g=[];this.molecule.atoms.each(function(t,e){if(0!=e.charge&&u.push([t,e.charge]),0!=e.isotope&&c.push([t,e.isotope]),0!=e.radical&&l.push([t,e.radical]),null!=e.rglabel&&"R#"==e.label)for(var n=0;n<32;n++)e.rglabel&1<<n&&f.push([t,n+1]);null!=e.attpnt&&d.push([t,e.attpnt]),0!=e.ringBondCount&&h.push([t,e.ringBondCount]),0!=e.substitutionCount&&g.push([t,e.substitutionCount]),0!=e.unsaturatedAtom&&m.push([t,e.unsaturatedAtom])}),t&&t.each(function(t,e){if(e.resth||e.ifthen>0||e.range.length>0){var n=" 1 "+a.paddedNum(t,3)+" "+a.paddedNum(e.ifthen,3)+" "+a.paddedNum(e.resth?1:0,3)+" "+e.range;p.push(n)}}),e.call(this,"M CHG",u),e.call(this,"M ISO",c),e.call(this,"M RAD",l),e.call(this,"M RGP",f);for(var v=0;v<p.length;++v)this.write("M LOG"+p[v]+"\n");if(e.call(this,"M APO",d),e.call(this,"M RBC",h),e.call(this,"M SUB",g),e.call(this,"M UNS",m),r.length>0)for(v=0;v<r.length;++v){var b=r[v],y=this.molecule.atoms.get(b).atomList;this.write("M ALS"),this.writePaddedNumber(b+1,4),this.writePaddedNumber(y.ids.length,3),this.writeWhiteSpace(),this.write(y.notList?"T":"F");for(var _=y.labelList(),x=0;x<_.length;++x)this.writeWhiteSpace(),this.writePadded(_[x],3);this.writeCR()}var w={},S=1,O={};this.molecule.sGroupForest.getSGroupsBFS().forEach(function(t){O[S]=t,w[t]=S++},this);for(var A=1;A<S;++A){var E=O[A],j=this.molecule.sgroups.get(E);this.write("M STY"),this.writePaddedNumber(1,3),this.writeWhiteSpace(1),this.writePaddedNumber(A,3),this.writeWhiteSpace(1),this.writePadded(j.type,3),this.writeCR(),this.write("M SLB"),this.writePaddedNumber(1,3),this.writeWhiteSpace(1),this.writePaddedNumber(A,3),this.writeWhiteSpace(1),this.writePaddedNumber(A,3),this.writeCR();var P=this.molecule.sGroupForest.parent.get(E);if(P>=0&&(this.write("M SPL"),this.writePaddedNumber(1,3),this.writeWhiteSpace(1),this.writePaddedNumber(A,3),this.writeWhiteSpace(1),this.writePaddedNumber(w[P],3),this.writeCR()),"SRU"==j.type&&j.data.connectivity){var T="";T+=" ",T+=A.toString().padStart(3),T+=" ",T+=(j.data.connectivity||"").padEnd(3),this.write("M SCN"),this.writePaddedNumber(1,3),this.write(T.toUpperCase()),this.writeCR()}"SRU"==j.type&&(this.write("M SMT "),this.writePaddedNumber(A,3),this.writeWhiteSpace(),this.write(j.data.subscript||"n"),this.writeCR()),this.writeCR(i.saveToMolfile[j.type](j,this.molecule,w,this.mapping,this.bondMapping))}this.writeCR("M END")},e.exports=r},{"./../element":516,"./common":518,"./utils":522}],521:[function(t,e,n){"use strict";function r(t,e){for(var n={},r=P.partitionLineFixed(t,3,!0),o=P.parseDecimalInt(r[0]),i=0;i<o;++i)n[P.parseDecimalInt(r[2*i+1])-1]=e?r[2*i+2].trim():P.parseDecimalInt(r[2*i+2]);return n}function o(t,e){for(var n=[],r=P.partitionLineFixed(t,3,!0),o=P.parseDecimalInt(r[0]),i=0;i<o;++i)n.push([P.parseDecimalInt(r[2*i+1])-1,e?r[2*i+2].trim():P.parseDecimalInt(r[2*i+2])]);return n}function i(t,e,n){t.data.mul=t.data.subscript-0;var r={};t.atoms=j.SGroup.filterAtoms(t.atoms,n),t.patoms=j.SGroup.filterAtoms(t.patoms,n);for(var o=1;o<t.data.mul;++o)for(var i=0;i<t.patoms.length;++i){var a=t.atoms[o*t.patoms.length+i];if(!(a<0)){if(t.patoms[i]<0)throw new Error("parent atom missing");r[a]=t.patoms[i]}}t.patoms=j.SGroup.removeNegative(t.patoms);var s=O(t.patoms),u=[];e.bonds.each(function(t,e){var n=e.begin in r,o=e.end in r;n&&o||n&&e.end in s||o&&e.begin in s?u.push(t):n?e.begin=r[e.begin]:o&&(e.end=r[e.end])},t);for(var c=0;c<u.length;++c)e.bonds.remove(u[c]);for(var l in r)e.atoms.remove(l),n[l]=-1;t.atoms=t.patoms,t.patoms=null}function a(t){t.data.connectivity=(t.data.connectivity||"EU").trim().toLowerCase()}function s(t){t.data.name=(t.data.subscript||"").trim(),t.data.subscript=""}function u(t,e,n){}function c(t,e){t.data.absolute||(t.pp=t.pp.add(j.SGroup.getMassCentre(e,t.atoms)))}function l(t,e,n){var r={MUL:i,SRU:a,SUP:s,DAT:c,GEN:u};e.id=t.sgroups.add(e),r[e.type](e,t,n);for(var o=0;o<e.atoms.length;++o)t.atoms.has(e.atoms[o])&&A.add(t.atoms.get(e.atoms[o]).sgs,e.id);return"DAT"==e.type?t.sGroupForest.insert(e.id,-1,[]):t.sGroupForest.insert(e.id),e.id}function f(t,e){var n=r(e,!0);for(var o in n){var i=n[o];if(!(i in j.SGroup.TYPES))throw new Error("Unsupported S-group type");var a=new j.SGroup(i);a.number=o,t[o]=a}}function p(t,e,n,o,i){var a=r(n,!o);for(var s in a)(i?t[s]:t[s].data)[e]=a[s]}function d(t,e,n,r){var o=P.parseDecimalInt(n.slice(1,4))-1,i=P.parseDecimalInt(n.slice(4,8)),a=w(P.partitionLineFixed(n.slice(8),3,!0));if(a.length!=i)throw new Error("File format invalid");r&&(a=a.map(function(t){return t+r})),t[o][e]=t[o][e].concat(a)}function h(t,e){t.data.fieldName=e}function m(t,e){t.data.query=e}function g(t,e){t.data.queryOp=e}function v(t,e){var n=P.partitionLine(e,[4,31,2,20,2,3],!1),r=P.parseDecimalInt(n[0])-1,o=n[1].trim(),i=n[2].trim(),a=n[3].trim(),s=n[4].trim(),u=n[5].trim(),c=t[r];c.data.fieldType=i,c.data.fieldName=o,c.data.units=a,c.data.query=s,c.data.queryOp=u}function b(t,e){var n=P.partitionLine(e,[10,10,4,1,1,1,3,3,3,3,2,3,2],!1),r=parseFloat(n[0]),o=parseFloat(n[1]),i="A"==n[3].trim(),a="A"==n[4].trim(),s="U"==n[5].trim(),u=n[7].trim();u="ALL"==u?-1:P.parseDecimalInt(u);var c=n[10].trim(),l=P.parseDecimalInt(n[11].trim());t.pp=new E(r,-o),t.data.attached=i,t.data.absolute=a,t.data.showUnits=s,t.data.nCharsToDisplay=u,t.data.tagChar=c,t.data.daspPos=l}function y(t,e){b(t[P.parseDecimalInt(e.substr(0,4))-1],e.substr(5))}function _(t,e,n){t.data.fieldValue=(t.data.fieldValue||"")+e,n&&(t.data.fieldValue=S(t.data.fieldValue),t.data.fieldValue.startsWith('"')&&t.data.fieldValue.endsWith('"')&&(t.data.fieldValue=t.data.fieldValue.substr(1,t.data.fieldValue.length-2)))}function x(t,e,n){var r=P.parseDecimalInt(e.substr(0,5))-1,o=e.substr(5);_(t[r],o,n)}function w(t){for(var e=[],n=0;n<t.length;++n)e[n]=P.parseDecimalInt(t[n]);return e}function S(t){return t.replace(/\s+$/,"")}function O(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=t[n];return e}var A=t("../../util/set"),E=t("../../util/vec2"),j=t("./../struct/index"),P=t("./utils");e.exports={readKeyValuePairs:r,readKeyMultiValuePairs:o,loadSGroup:l,initSGroup:f,applySGroupProp:p,applySGroupArrayProp:d,applyDataSGroupName:h,applyDataSGroupQuery:m,applyDataSGroupQueryOp:g,applyDataSGroupDesc:v,applyDataSGroupInfo:b,applyDataSGroupData:_,applyDataSGroupInfoLine:y,applyDataSGroupDataLine:x}},{"../../util/set":656,"../../util/vec2":657,"./../struct/index":533,"./utils":522}],522:[function(t,e,n){"use strict";function r(t,e,n){var r=t.toFixed(n||0).replace(",",".");if(r.length>e)throw new Error("number does not fit");return r.padStart(e)}function o(t){var e=parseInt(t,10);return isNaN(e)?0:e}function i(t,e,n){for(var r=[],o=0,i=0;o<e.length;++o)r.push(t.slice(i,i+e[o])),n&&i++,i+=e[o];return r}function a(t,e,n){for(var r=[],o=0;o<t.length;o+=e)r.push(t.slice(o,o+e)),n&&o++;return r}function s(t,e,n){function r(t,e,n,r,o){var i=new u(r-n.min.x,o?1-n.min.y:-(n.min.y+n.max.y)/2);return e.atoms.each(function(t,e){e.pp.add_(i)}),e.sgroups.each(function(t,e){e.pp&&e.pp.add_(i)}),n.min.add_(i),n.max.add_(i),e.mergeInto(t),n.max.x-n.min.x}var o,i=new c,a=[],s=[],l=[],h=[],m=[],g=[],v={cnt:0,totalLength:0};for(o=0;o<t.length;++o){var b=t[o],y=b.getBondLengthData();v.cnt+=y.cnt,v.totalLength+=y.totalLength}if(d){var _=1/(0==v.cnt?1:v.totalLength/v.cnt);for(o=0;o<t.length;++o)b=t[o],b.scale(_)}for(o=0;o<t.length;++o){b=t[o];var x=b.getCoordBoundingBoxObj();if(x){var w=o<e?f.REACTANT:o<e+n?f.PRODUCT:f.AGENT;w==f.REACTANT?(a.push(x),h.push(b)):w==f.AGENT?(s.push(x),m.push(b)):w==f.PRODUCT&&(l.push(x),g.push(b)),b.atoms.each(function(t,e){e.rxnFragmentType=w})}}if(p){var S=0;for(o=0;o<h.length;++o)S+=r(i,h[o],a[o],S,!1)+2;for(S+=2,o=0;o<m.length;++o)S+=r(i,m[o],s[o],S,!0)+2;for(S+=2,o=0;o<g.length;++o)S+=r(i,g[o],l[o],S,!1)+2}else{for(o=0;o<h.length;++o)h[o].mergeInto(i);for(o=0;o<m.length;++o)m[o].mergeInto(i);for(o=0;o<g.length;++o)g[o].mergeInto(i)}var O,A,E,j,P=null,T=null;for(o=0;o<a.length-1;++o)O=a[o],A=a[o+1],E=(O.max.x+A.min.x)/2,j=(O.max.y+O.min.y+A.max.y+A.min.y)/4,i.rxnPluses.add(new c.RxnPlus({pp:new u(E,j)}));for(o=0;o<a.length;++o)0==o?(P={},P.max=new u(a[o].max),P.min=new u(a[o].min)):(P.max=u.max(P.max,a[o].max),P.min=u.min(P.min,a[o].min));for(o=0;o<l.length-1;++o)O=l[o],A=l[o+1],E=(O.max.x+A.min.x)/2,j=(O.max.y+O.min.y+A.max.y+A.min.y)/4,i.rxnPluses.add(new c.RxnPlus({pp:new u(E,j)}));for(o=0;o<l.length;++o)0==o?(T={},T.max=new u(l[o].max),T.min=new u(l[o].min)):(T.max=u.max(T.max,l[o].max),T.min=u.min(T.min,l[o].min));if(O=P,A=T,O||A){var C=O?new u(O.max.x,(O.max.y+O.min.y)/2):null,R=A?new u(A.min.x,(A.max.y+A.min.y)/2):null;C||(C=new u(R.x-3,R.y)),R||(R=new u(C.x+3,C.y)),i.rxnArrows.add(new c.RxnArrow({pp:u.lc2(C,.5,R,.5)}))}else i.rxnArrows.add(new c.RxnArrow({pp:new u(0,0)}));return i.isReaction=!0,i}var u=t("../../util/vec2"),c=t("./../struct/index"),l={bondTypeMap:{1:c.Bond.PATTERN.TYPE.SINGLE,2:c.Bond.PATTERN.TYPE.DOUBLE,3:c.Bond.PATTERN.TYPE.TRIPLE,4:c.Bond.PATTERN.TYPE.AROMATIC,5:c.Bond.PATTERN.TYPE.SINGLE_OR_DOUBLE,6:c.Bond.PATTERN.TYPE.SINGLE_OR_AROMATIC,7:c.Bond.PATTERN.TYPE.DOUBLE_OR_AROMATIC,8:c.Bond.PATTERN.TYPE.ANY},bondStereoMap:{0:c.Bond.PATTERN.STEREO.NONE,1:c.Bond.PATTERN.STEREO.UP,4:c.Bond.PATTERN.STEREO.EITHER,6:c.Bond.PATTERN.STEREO.DOWN,3:c.Bond.PATTERN.STEREO.CIS_TRANS},v30bondStereoMap:{0:c.Bond.PATTERN.STEREO.NONE,1:c.Bond.PATTERN.STEREO.UP,2:c.Bond.PATTERN.STEREO.EITHER,3:c.Bond.PATTERN.STEREO.DOWN},bondTopologyMap:{0:c.Bond.PATTERN.TOPOLOGY.EITHER,1:c.Bond.PATTERN.TOPOLOGY.RING,2:c.Bond.PATTERN.TOPOLOGY.CHAIN},countsLinePartition:[3,3,3,3,3,3,3,3,3,3,3,6],atomLinePartition:[10,10,10,1,3,2,3,3,3,3,3,3,3,3,3,3,3],bondLinePartition:[3,3,3,3,3,3,3],atomListHeaderPartition:[3,1,1,4,1,1],atomListHeaderLength:11,atomListHeaderItemLength:4,chargeMap:[0,3,2,1,0,-1,-2,-3],valenceMap:[void 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,0],implicitHydrogenMap:[void 0,0,1,2,3,4],v30atomPropMap:{CHG:"charge",RAD:"radical",MASS:"isotope",VAL:"explicitValence",HCOUNT:"hCount",INVRET:"invRet",SUBST:"substitutionCount",UNSAT:"unsaturatedAtom",RBCNT:"ringBondCount"},rxnItemsPartition:[3,3,3]},f={NONE:0,REACTANT:1,PRODUCT:2,AGENT:3},p=!0,d=!0;e.exports={fmtInfo:l,paddedNum:r,parseDecimalInt:o,partitionLine:i,partitionLineFixed:a,rxnMerge:s}},{"../../util/vec2":657,"./../struct/index":533}],523:[function(t,e,n){"use strict";function r(t){var e=_.partitionLine(t,_.fmtInfo.atomLinePartition),n={pp:new m(parseFloat(e[0]),-parseFloat(e[1]),parseFloat(e[2])),label:e[4].trim(),explicitValence:_.fmtInfo.valenceMap[_.parseDecimalInt(e[10])],massDifference:_.parseDecimalInt(e[5]),charge:_.fmtInfo.chargeMap[_.parseDecimalInt(e[6])],hCount:_.parseDecimalInt(_.parseDecimalInt(e[8])),stereoCare:0!=_.parseDecimalInt(e[9]),aam:_.parseDecimalInt(e[14]),invRet:_.parseDecimalInt(e[15]),exactChangeFlag:0!=_.parseDecimalInt(e[16])};return new b.Atom(n)}function o(t){var e=_.partitionLine(t,_.fmtInfo.bondLinePartition),n={begin:_.parseDecimalInt(e[0])-1,end:_.parseDecimalInt(e[1])-1,type:_.fmtInfo.bondTypeMap[_.parseDecimalInt(e[2])],stereo:_.fmtInfo.bondStereoMap[_.parseDecimalInt(e[3])],xxx:e[4],topology:_.fmtInfo.bondTopologyMap[_.parseDecimalInt(e[5])],reactingCenterStatus:_.parseDecimalInt(e[6])};return new b.Bond(n)}function i(t){for(var e=_.partitionLine(t,_.fmtInfo.atomListHeaderPartition),n=_.parseDecimalInt(e[0])-1,r="T"==e[2].trim(),o=_.parseDecimalInt(e[4].trim()),i=t.slice(_.fmtInfo.atomListHeaderLength),a=[],s=_.fmtInfo.atomListHeaderItemLength,u=0;u<o;++u)a[u]=_.parseDecimalInt(i.slice(u*s,(u+1)*s-1));return{aid:n,atomList:new b.AtomList({notList:r,ids:a})}}function a(t,e,n,r,o,i){for(var a=new g;n<r;){var s=e[n];if("A"==s.charAt(0)){var u=e[++n],c=/'.+'/.test(u);c&&!a.get("pseudo")&&a.set("pseudo",new g),c||a.get("alias")||a.set("alias",new g),c&&(u=u.replace(/'/g,"")),a.get(c?"pseudo":"alias").set(_.parseDecimalInt(s.slice(3,6))-1,u)}else if("M"==s.charAt(0)){var l=s.slice(3,6),f=s.slice(6);if("END"==l)break;if("CHG"==l)a.get("charge")||a.set("charge",new g),a.get("charge").update(y.readKeyValuePairs(f));else if("RAD"==l)a.get("radical")||a.set("radical",new g),a.get("radical").update(y.readKeyValuePairs(f));else if("ISO"==l)a.get("isotope")||a.set("isotope",new g),a.get("isotope").update(y.readKeyValuePairs(f));else if("RBC"==l)a.get("ringBondCount")||a.set("ringBondCount",new g),a.get("ringBondCount").update(y.readKeyValuePairs(f));else if("SUB"==l)a.get("substitutionCount")||a.set("substitutionCount",new g),a.get("substitutionCount").update(y.readKeyValuePairs(f));else if("UNS"==l)a.get("unsaturatedAtom")||a.set("unsaturatedAtom",new g),a.get("unsaturatedAtom").update(y.readKeyValuePairs(f));else if("RGP"==l){a.get("rglabel")||a.set("rglabel",new g);for(var p=a.get("rglabel"),d=y.readKeyMultiValuePairs(f),m=0;m<d.length;m++){var v=d[m];p.set(v[0],(p.get(v[0])||0)|1<<v[1]-1)}}else if("LOG"==l){f=f.slice(4);var b=_.parseDecimalInt(f.slice(0,3).trim()),x=_.parseDecimalInt(f.slice(4,7).trim()),w=_.parseDecimalInt(f.slice(8,11).trim()),S=f.slice(12).trim(),O={};x>0&&(O.ifthen=x),O.resth=1==w,O.range=S,i[b]=O}else if("APO"==l)a.get("attpnt")||a.set("attpnt",new g),a.get("attpnt").update(y.readKeyValuePairs(f));else if("ALS"==l){a.get("atomList")||a.set("atomList",new g);var A=h(_.partitionLine(f,[1,3,3,1,1,1]),_.partitionLineFixed(f.slice(10),4,!1));a.get("atomList").update(A),a.get("label")||a.set("label",new g);for(var E in A)a.get("label").set(E,"L#")}else if("STY"==l)y.initSGroup(o,f);else if("SST"==l)y.applySGroupProp(o,"subtype",f);else if("SLB"==l)y.applySGroupProp(o,"label",f,!0);else if("SPL"==l)y.applySGroupProp(o,"parent",f,!0,!0);else if("SCN"==l)y.applySGroupProp(o,"connectivity",f);else if("SAL"==l)y.applySGroupArrayProp(o,"atoms",f,-1);else if("SBL"==l)y.applySGroupArrayProp(o,"bonds",f,-1);else if("SPA"==l)y.applySGroupArrayProp(o,"patoms",f,-1);else if("SMT"==l){var j=_.parseDecimalInt(f.slice(0,4))-1;o[j].data.subscript=f.slice(4).trim()}else"SDT"==l?y.applyDataSGroupDesc(o,f):"SDD"==l?y.applyDataSGroupInfoLine(o,f):"SCD"==l?y.applyDataSGroupDataLine(o,f,!1):"SED"==l&&y.applyDataSGroupDataLine(o,f,!0)}++n}return a}function s(t,e,n){e.each(function(e,r){t.get(e)[n]=r})}function u(t,e){var n,u=new b,c=_.parseDecimalInt(e[0]),l=_.parseDecimalInt(e[1]),f=_.parseDecimalInt(e[2]);u.isChiral=0!=_.parseDecimalInt(e[4]);var p=_.parseDecimalInt(e[5]),d=_.parseDecimalInt(e[10]),h=0,m=t.slice(h,h+c);h+=c;var g=t.slice(h,h+l);h+=l;var v=t.slice(h,h+f);h+=f+p;var x=m.map(r);for(n=0;n<x.length;++n)u.atoms.add(x[n]);var w=g.map(o);for(n=0;n<w.length;++n)u.bonds.add(w[n]);v.map(i).forEach(function(t){u.atoms.get(t.aid).atomList=t.atomList,u.atoms.get(t.aid).label="L#"});var S={},O={};a(u,t,h,Math.min(t.length,h+d),S,O).each(function(t,e){s(u.atoms,e,t)});var A,E={};for(A in S){var j=S[A];if("DAT"===j.type&&0===j.atoms.length){var P=S[A].parent;if(P>=0){var T=S[P-1];"GEN"===T.type&&(j.atoms=[].slice.call(T.atoms))}}}for(A in S)y.loadSGroup(u,S[A],E);var C=[];for(A in S)b.SGroup.filter(u,S[A],E),0!=S[A].atoms.length||S[A].allAtoms||C.push(A);for(n=0;n<C.length;++n)u.sGroupForest.remove(C[n]),u.sgroups.remove(C[n]);for(var R in O)u.rgroups.set(R,new b.RGroup(O[R]));return u}function c(t){if(t=t.slice(7),"$CTAB"!=t[0].trim())throw new Error("RGFile format invalid");for(var e=1;"$"!=t[e].charAt(0);)e++;if("$END CTAB"!=t[e].trim())throw new Error("RGFile format invalid");var n=t.slice(1,e);t=t.slice(e+1);for(var r={};;){if(0==t.length)throw new Error("Unexpected end of file");var o=t[0].trim();if("$END MOL"==o){t=t.slice(1);break}if("$RGP"!=o)throw new Error("RGFile format invalid");var i=t[1].trim()-0;for(r[i]=[],t=t.slice(2);;){if(0==t.length)throw new Error("Unexpected end of file");if("$END RGP"==(o=t[0].trim())){t=t.slice(1);break}if("$CTAB"!=o)throw new Error("RGFile format invalid");for(e=1;"$"!=t[e].charAt(0);)e++;if("$END CTAB"!=t[e].trim())throw new Error("RGFile format invalid");r[i].push(t.slice(1,e)),t=t.slice(e+1)}}var a=f(n),s={};if(x)for(var u in r){s[u]=[];for(var c=0;c<r[u].length;++c)s[u].push(f(r[u][c]))}return p(a,s)}function l(t){t=t.slice(4);var e=_.partitionLine(t[0],_.fmtInfo.rxnItemsPartition),n=e[0]-0,r=e[1]-0,o=e[2]-0;t=t.slice(1);for(var i=[];t.length>0&&"$MOL"==t[0].substr(0,4);){t=t.slice(1);for(var a=0;a<t.length&&"$MOL"!=t[a].substr(0,4);)a++;var s,u=t.slice(0,a);0==u[0].search("\\$MDL")?s=c(u):(s=f(u.slice(3)),s.name=u[0].trim()),i.push(s),t=t.slice(a)}return _.rxnMerge(i,n,r,o)}function f(t){var e=_.partitionLine(t[0],_.fmtInfo.countsLinePartition);return t=t.slice(1),u(t,e)}function p(t,e){var n=new b;t.mergeInto(n,null,null,!1,!0);for(var r in e)for(var o=0;o<e[r].length;++o){var i=e[r][o];i.rgroups.set(r,new b.RGroup);var a={},s=i.frags.add(a);i.rgroups.get(r).frags.add(s),i.atoms.each(function(t,e){e.fragment=s}),i.mergeInto(n)}return n}function d(t){for(var e=[],n=0;n<t.length;++n)e.push(v.map[t[n].trim()]);return e}function h(t,e){var n=_.parseDecimalInt(t[1])-1,r=_.parseDecimalInt(t[2]),o="T"==t[4].trim(),i=d(e.slice(0,r)),a={};return a[n]=new b.AtomList({notList:o,ids:i}),a}var m=t("../../util/vec2"),g=t("../../util/map"),v=t("./../element"),b=t("./../struct/index"),y=t("./parseSGroup"),_=t("./utils"),x=!0;e.exports={parseCTabV2000:u,parseRg2000:c,parseRxn2000:l}},{"../../util/map":653,"../../util/vec2":657,"./../element":516,"./../struct/index":533,"./parseSGroup":521,"./utils":522}],524:[function(t,e,n){"use strict";function r(t){var e,n,r,o,i;e=l(t);var a={pp:new v(parseFloat(e[2]),-parseFloat(e[3]),parseFloat(e[4])),aam:e[5].trim()},s=e[1].trim();if('"'==s.charAt(0)&&'"'==s.charAt(s.length-1)&&(s=s.substr(1,s.length-2)),"]"==s.charAt(s.length-1)){s=s.substr(0,s.length-1);var u={};if(u.notList=!1,"NOT ["==s.substr(0,5))u.notList=!0,s=s.substr(5);else{if("["!=s.charAt(0))throw new Error("Error: atom list expected, found '"+s+"'");s=s.substr(1)}u.ids=g(s.split(",")),a.atomList=new y.AtomList(u),a.label="L#"}else a.label=s;for(e.splice(0,6),i=0;i<e.length;++i)if(n=p(e[i],"="),r=n[0],o=n[1],r in x.fmtInfo.v30atomPropMap){var c=x.parseDecimalInt(o);if("VAL"==r){if(0==c)continue;-1==c&&(c=0)}a[x.fmtInfo.v30atomPropMap[r]]=c}else if("RGROUPS"==r){o=o.trim().substr(1,o.length-2);var f=o.split(" ").slice(1);a.rglabel=0;for(var d=0;d<f.length;++d)a.rglabel|=1<<f[d]-1}else"ATTCHPT"==r&&(a.attpnt=o.trim()-0);return new y.Atom(a)}function o(t){var e,n,r,o,i;e=l(t);var a={begin:x.parseDecimalInt(e[2])-1,end:x.parseDecimalInt(e[3])-1,type:x.fmtInfo.bondTypeMap[x.parseDecimalInt(e[1])]};for(e.splice(0,4),i=0;i<e.length;++i)n=p(e[i],"="),r=n[0],o=n[1],"CFG"==r?(a.stereo=x.fmtInfo.v30bondStereoMap[x.parseDecimalInt(o)],a.type==y.Bond.PATTERN.TYPE.DOUBLE&&a.stereo==y.Bond.PATTERN.STEREO.EITHER&&(a.stereo=y.Bond.PATTERN.STEREO.CIS_TRANS)):"TOPO"==r?a.topology=x.fmtInfo.bondTopologyMap[x.parseDecimalInt(o)]:"RXCTR"==r?a.reactingCenterStatus=x.parseDecimalInt(o):"STBOX"==r&&(a.stereoCare=x.parseDecimalInt(o));return new y.Bond(a)}function i(t,e,n){for(n++;"M V30 END COLLECTION"!=e[n].trim();)n++;return++n}function a(t,e,n,r,o){var i="";for(o++;o<e.length;){if(i=m(e[o++]).trim(),"END SGROUP"==i.trim())return o;for(;"-"==i.charAt(i.length-1);)i=(i.substr(0,i.length-1)+m(e[o++])).trim();var a=d(i),s=a[1],u=new y.SGroup(s);u.number=a[0]-0,u.type=s,u.label=a[2]-0,n[u.number]=u;for(var c={},l=3;l<a.length;++l){var g=p(a[l],"=");if(2!=g.length)throw new Error("A record of form AAA=BBB or AAA=(...) expected, got '"+a[l]+"'");var v=g[0];v in c||(c[v]=[]),c[v].push(g[1])}u.atoms=h(c.ATOMS[0],-1),c.PATOMS&&(u.patoms=h(c.PATOMS[0],-1)),u.bonds=c.BONDS?h(c.BONDS[0],-1):[];var b=c.BRKXYZ;if(u.brkxyz=[],b)for(var x=0;x<b.length;++x)u.brkxyz.push(h(b[x]));c.MULT&&(u.data.subscript=c.MULT[0]-0),c.LABEL&&(u.data.subscript=c.LABEL[0].trim()),c.CONNECT&&(u.data.connectivity=c.CONNECT[0].toLowerCase()),c.FIELDDISP&&_.applyDataSGroupInfo(u,f(c.FIELDDISP[0])),c.FIELDDATA&&_.applyDataSGroupData(u,c.FIELDDATA[0],!0),c.FIELDNAME&&_.applyDataSGroupName(u,c.FIELDNAME[0]),c.QUERYTYPE&&_.applyDataSGroupQuery(u,c.QUERYTYPE[0]),c.QUERYOP&&_.applyDataSGroupQueryOp(u,c.QUERYOP[0]),_.loadSGroup(t,u,r)}throw new Error("S-group declaration incomplete.")}function s(t,e){var n=new y,s=0;if("M V30 BEGIN CTAB"!=t[s++].trim())throw Error("CTAB V3000 invalid");if("M V30 COUNTS"!=t[s].slice(0,13))throw Error("CTAB V3000 invalid");var c=t[s].slice(14).split(" ");if(n.isChiral=1==x.parseDecimalInt(c[4]),s++,"M V30 BEGIN ATOM"==t[s].trim()){s++;for(var l;s<t.length&&"END ATOM"!=(l=m(t[s++]).trim());){for(;"-"==l.charAt(l.length-1);)l=(l.substring(0,l.length-1)+m(t[s++])).trim();n.atoms.add(r(l))}if("M V30 BEGIN BOND"==t[s].trim())for(s++;s<t.length&&"END BOND"!=(l=m(t[s++]).trim());){for(;"-"==l.charAt(l.length-1);)l=(l.substring(0,l.length-1)+m(t[s++])).trim();n.bonds.add(o(l))}for(var f={},p={};"M V30 END CTAB"!=t[s].trim();)if("M V30 BEGIN COLLECTION"==t[s].trim())s=i(n,t,s);else{if("M V30 BEGIN SGROUP"!=t[s].trim())throw Error("CTAB V3000 invalid");s=a(n,t,f,p,s)}}if("M V30 END CTAB"!=t[s++].trim())throw Error("CTAB V3000 invalid");return e||u(n,t.slice(s)),n}function u(t,e){for(var n={},r={},o=0;o<e.length&&0==e[o].search("M V30 BEGIN RGROUP");){var i=e[o++].split(" ").pop();for(n[i]=[],r[i]={};;){var a=e[o].trim();if(0!=a.search("M V30 RLOGIC")){if("M V30 BEGIN CTAB"!=a)throw Error("CTAB V3000 invalid");for(var u=0;u<e.length&&"M V30 END CTAB"!=e[o+u].trim();++u);var c=e.slice(o,o+u+1),l=s(c,!0);if(n[i].push(l),o=o+u+1,"M V30 END RGROUP"==e[o].trim()){o++;break}}else{a=a.slice(13);var f=a.trim().split(/\s+/g),p=x.parseDecimalInt(f[0]),d=x.parseDecimalInt(f[1]),h=f.slice(2).join(" "),m={};p>0&&(m.ifthen=p),m.resth=1==d,m.range=h,r[i]=m,o++}}}for(var g in n)for(var v=0;v<n[g].length;++v){var b=n[g][v];b.rgroups.set(g,new y.RGroup(r[g]));var _=b.frags.add({});b.rgroups.get(g).frags.add(_),b.atoms.each(function(t,e){e.fragment=_}),b.mergeInto(t)}}function c(t){t=t.slice(4);for(var e=t[0].split(/\s+/g).slice(3),n=e[0]-0,r=e[1]-0,o=e.length>2?e[2]-0:0,i=[],a=[],c=null,l=[],f=0;f<t.length;++f){var p,d=t[f].trim();if(d.startsWith("M V30 COUNTS"));else{if("M END"==d)break;if("M V30 BEGIN PRODUCT"==d)console.assert(null==c,"CTab format invalid"),c=a;else if("M V30 END PRODUCT"==d)console.assert(c===a,"CTab format invalid"),c=null;else if("M V30 BEGIN REACTANT"==d)console.assert(null==c,"CTab format invalid"),c=i;else if("M V30 END REACTANT"==d)console.assert(c===i,"CTab format invalid"),c=null;else if(d.startsWith("M V30 BEGIN RGROUP"))console.assert(null==c,"CTab format invalid"),p=function(e){for(var n=e;n<t.length;++n)if("M V30 END RGROUP"==t[n].trim())return n;console.error("CTab format invalid")}(f),l.push(t.slice(f,p+1)),f=p;else{if("M V30 BEGIN CTAB"!=d)throw new Error("line unrecognized: "+d);p=function(e){for(var n=e;n<t.length;++n)if("M V30 END CTAB"==t[n].trim())return n;console.error("CTab format invalid")}(f),c.push(t.slice(f,p+1)),f=p}}}var h=[],m=i.concat(a);for(p=0;p<m.length;++p){var g=s(m[p],e);h.push(g)}var v=x.rxnMerge(h,n,r,o);return u(v,function(t){for(var e=[],n=0;n<t.length;++n)e=e.concat(t[n]);return e}(l)),v}function l(t){var e,n,r=[],o=0,i=-1,a=!1;for(n=0;n<t.length;++n)e=t[n],"("==e?o++:")"==e&&o--,'"'==e&&(a=!a),a||" "!=t[n]||0!=o||(n>i+1&&r.push(t.slice(i+1,n)),i=n);return n>i+1&&r.push(t.slice(i+1,n)),r}function f(t){return'"'===t[0]&&'"'===t[t.length-1]?t.substr(1,t.length-2):t}function p(t,e){var n=t.indexOf(e);return[t.slice(0,n),t.slice(n+1)]}function d(t){for(var e=[],n=0,r=!1,o=0;o<t.length;++o){var i=t.charAt(o);'"'==i?r=!r:r||("("==i?n++:")"==i?n--:" "==i&&0==n&&(e.push(t.slice(0,o)),t=t.slice(o+1).trim(),o=0))}if(0!=n)throw new Error("Brace balance broken. S-group properies invalid!");return t.length>0&&e.push(t.trim()),e}function h(t,e){if(!t)return null;var n=[];t=t.trim(),t=t.substr(1,t.length-2);var r=t.split(" ");e=e||0;for(var o=1;o<r.length;++o){var i=parseInt(r[o]);isNaN(i)||n.push(i+e)}return n}function m(t){if("M V30 "!=t.slice(0,7))throw new Error("Prefix invalid");return t.slice(7)}function g(t){for(var e=[],n=0;n<t.length;++n)e.push(b.map[t[n].trim()]);return e}var v=t("../../util/vec2"),b=t("./../element"),y=t("./../struct/index"),_=t("./parseSGroup"),x=t("./utils");e.exports={parseCTabV3000:s,readRGroups3000:u,parseRxn3000:c}},{"../../util/vec2":657,"./../element":516,"./../struct/index":533,"./parseSGroup":521,"./utils":522}],
525:[function(t,e,n){"use strict";function r(t,e){for(var n,r,o=/^[^]+?\$\$\$\$$/gm,a=[];null!==(n=o.exec(t));){r=n[0].replace(/\r/g,""),r=r.trim();var s=r.indexOf("M END");if(-1!==s){var u={},c=r.substr(s+7).trim().split(/^$\n?/m);u.struct=i.parse(r.substring(0,s+6),e),u.props=c.reduce(function(t,e){var n=e.match(/^> [ \d]*<(\S+)>/);if(n){var r=n[1],o=e.split("\n")[1].trim();t[r]=o}return t},{}),a.push(u)}}return a}function o(t,e){return t.reduce(function(t,n){t+=i.stringify(n.struct,e);for(var r in n.props)t+="> <"+r+">\n",t+=n.props[r]+"\n\n";return t+"$$$$"},"")}var i=t("./molfile");e.exports={stringify:o,parse:r}},{"./molfile":519}],526:[function(t,e,n){"use strict";function r(t,e,n){this.molecule=t,this.bonds=new i,this.getNeighbors=e,this.context=n}function o(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}var i=t("../../util/map"),a=t("../../util/vec2"),s=t("../struct");r.PARITY={NONE:0,CIS:1,TRANS:2},r.prototype.each=function(t,e){this.bonds.each(t,e)},r.prototype.getParity=function(t){return this.bonds.get(t).parity},r.prototype.getSubstituents=function(t){return this.bonds.get(t).substituents},r.prototype.sameside=function(t,e,n,r){var o=a.diff(t,e),i=new a(-o.y,o.x);if(!i.normalize())return 0;var s=a.diff(n,t),u=a.diff(r,e);if(!s.normalize())return 0;if(!u.normalize())return 0;var c=a.dot(s,i),l=a.dot(u,i);return Math.abs(c)<.001||Math.abs(l)<.001?0:c*l>0?1:-1},r.prototype.samesides=function(t,e,n,r){return this.sameside(this.molecule.atoms.get(t).pp,this.molecule.atoms.get(e).pp,this.molecule.atoms.get(n).pp,this.molecule.atoms.get(r).pp)},r.prototype.sortSubstituents=function(t){var e=this.molecule.atoms.get(t[0]).pureHydrogen(),n=t[1]<0||this.molecule.atoms.get(t[1]).pureHydrogen(),r=this.molecule.atoms.get(t[2]).pureHydrogen(),i=t[3]<0||this.molecule.atoms.get(t[3]).pureHydrogen();return(!e||!n)&&((!r||!i)&&(n?t[1]=-1:e?(t[0]=t[1],t[1]=-1):t[0]>t[1]&&o(t,0,1),i?t[3]=-1:r?(t[2]=t[3],t[3]=-1):t[2]>t[3]&&o(t,2,3),!0))},r.prototype.isGeomStereoBond=function(t,e){var n=this.molecule.bonds.get(t);if(n.type!=s.Bond.PATTERN.TYPE.DOUBLE)return!1;var r=this.molecule.atoms.get(n.begin).label,o=this.molecule.atoms.get(n.end).label;if("C"!=r&&"N"!=r&&"Si"!=r&&"Ge"!=r)return!1;if("C"!=o&&"N"!=o&&"Si"!=o&&"Ge"!=o)return!1;var i=this.getNeighbors.call(this.context,n.begin),a=this.getNeighbors.call(this.context,n.end);if(i.length<2||i.length>3||a.length<2||a.length>3)return!1;e[0]=-1,e[1]=-1,e[2]=-1,e[3]=-1;var u,c;for(u=0;u<i.length;u++)if(c=i[u],c.bid!=t){if(this.molecule.bonds.get(c.bid).type!=s.Bond.PATTERN.TYPE.SINGLE)return!1;-1==e[0]?e[0]=c.aid:e[1]=c.aid}for(u=0;u<a.length;u++)if(c=a[u],c.bid!=t){if(this.molecule.bonds.get(c.bid).type!=s.Bond.PATTERN.TYPE.SINGLE)return!1;-1==e[2]?e[2]=c.aid:e[3]=c.aid}return(-1==e[1]||-1==this.samesides(n.begin,n.end,e[0],e[1]))&&(-1==e[3]||-1==this.samesides(n.begin,n.end,e[2],e[3]))},r.prototype.build=function(t){this.molecule.bonds.each(function(e,n){var o=this.bonds.set(e,{parity:0,substituents:[]});if((!Array.isArray(t)||!t[e])&&this.isGeomStereoBond(e,o.substituents)&&this.sortSubstituents(o.substituents)){var i=this.samesides(n.begin,n.end,o.substituents[0],o.substituents[2]);1==i?o.parity=r.PARITY.CIS:-1==i&&(o.parity=r.PARITY.TRANS)}},this)},e.exports=r},{"../../util/map":653,"../../util/vec2":657,"../struct":533}],527:[function(t,e,n){"use strict";function r(t,e,n,o){this.molecule=t,this.atom_data=e,this.components=n,this.nComponentsInReactants=-1,this.nReactants=o,this.vertices=new Array(this.molecule.atoms.count()),this.molecule.atoms.each(function(t){this.vertices[t]=new r.VertexDesc},this),this.edges=new Array(this.molecule.bonds.count()),this.molecule.bonds.each(function(t){this.edges[t]=new r.EdgeDesc},this),this.v_seq=[]}var o=t("../../util/set");r.VertexDesc=function(){this.dfs_state=0,this.parent_vertex=0,this.parent_edge=0,this.branches=0},r.EdgeDesc=function(){this.opening_cycles=0,this.closing_cycle=0},r.SeqElem=function(t,e,n){this.idx=t,this.parent_vertex=e,this.parent_edge=n},r.prototype.walk=function(){for(var t,e,n=[],i=0,a=0;;){if(n.length<1){for(var s=-1,u=function(t){return 0==this.vertices[t].dfs_state&&(s=t,!0)};i<this.components.length&&-1==s;)s=o.find(this.components[i],u,this),null===s&&(s=-1,i++),i==this.nReactants&&(this.nComponentsInReactants=a);if(s<-1&&this.molecule.atoms.find(u,this),-1==s)break;this.vertices[s].parent_vertex=-1,this.vertices[s].parent_edge=-1,n.push(s),a++}var c=n.pop(),l=this.vertices[c].parent_vertex,f=new r.SeqElem(c,l,this.vertices[c].parent_edge);this.v_seq.push(f),this.vertices[c].dfs_state=2;var p=this.atom_data[c];for(t=0;t<p.neighbours.length;t++){var d=p.neighbours[t].aid,h=p.neighbours[t].bid;if(d!=l)if(2==this.vertices[d].dfs_state){for(this.edges[h].closing_cycle=1,e=c;-1!=e&&this.vertices[e].parent_vertex!=d;)e=this.vertices[e].parent_vertex;if(-1==e)throw new Error("cycle unwind error");this.edges[this.vertices[e].parent_edge].opening_cycles++,this.vertices[c].branches++,f=new r.SeqElem(d,c,h),this.v_seq.push(f)}else{if(1==this.vertices[d].dfs_state){if(-1==(e=n.indexOf(d)))throw new Error("internal: removing vertex from stack");n.splice(e,1);var m=this.vertices[d].parent_vertex;m>=0&&this.vertices[m].branches--}this.vertices[c].branches++,this.vertices[d].parent_vertex=c,this.vertices[d].parent_edge=h,this.vertices[d].dfs_state=1,n.push(d)}}}},r.prototype.edgeClosingCycle=function(t){return 0!=this.edges[t].closing_cycle},r.prototype.numBranches=function(t){return this.vertices[t].branches},r.prototype.numOpeningCycles=function(t){return this.edges[t].opening_cycles},r.prototype.toString=function(){var t="";return this.v_seq.each(function(e){t+=e.idx+" -> "}),t+="*"},e.exports=r},{"../../util/set":656}],528:[function(t,e,n){"use strict";function r(){this.smiles="",this.writtenAtoms=[],this.writtenComponents=0,this.ignore_errors=!1}var o=t("../../util/set"),i=t("../struct"),a=t("./cis_trans"),s=t("./dfs"),u=t("./stereocenters");r._Atom=function(t){this.neighbours=[],this.aromatic=!1,this.lowercase=!1,this.chirality=0,this.branch_cnt=0,this.paren_written=!1,this.h_count=t,this.parent=-1},r.prototype.isBondInRing=function(t){return console.assert(this.inLoop,"Init this.inLoop prior to calling this method"),this.inLoop[t]},r.prototype.saveMolecule=function(t,e){var n,a,c;e||(this.ignore_errors=e),t=t.clone(),t.initHalfBonds(),t.initNeighbors(),t.sortNeighbors(),t.setImplicitHydrogen(),t.sgroups.each(function(e,n){if("MUL"==n.type)try{i.SGroup.prepareMulForSaving(n,t)}catch(t){throw{message:"Bad s-group ("+t.message+")"}}},this),this.atoms=new Array(t.atoms.count()),t.atoms.each(function(t,e){this.atoms[t]=new r._Atom(e.implicitH)},this);var l=["B","C","N","O","P","S","Se","As"];t.bonds.each(function(e,n){n.type==i.Bond.PATTERN.TYPE.AROMATIC&&(this.atoms[n.begin].aromatic=!0,-1!=l.indexOf(t.atoms.get(n.begin).label)&&(this.atoms[n.begin].lowercase=!0),this.atoms[n.end].aromatic=!0,-1!=l.indexOf(t.atoms.get(n.end).label)&&(this.atoms[n.end].lowercase=!0)),this.atoms[n.begin].neighbours.push({aid:n.end,bid:e}),this.atoms[n.end].neighbours.push({aid:n.begin,bid:e})},this),this.inLoop=function(){t.prepareLoopStructure();var e=o.empty();t.loops.each(function(n,r){r.hbs.length<=6&&o.mergeIn(e,o.fromList(r.hbs.map(function(e){return t.halfBonds.get(e).bid})))});var n={};return o.each(e,function(t){n[t]=1},this),n}(),this.touchedCistransbonds=0,this.markCisTrans(t);var f=t.getComponents(),p=f.reactants.concat(f.products),d=new s(t,this.atoms,p,f.reactants.length);for(d.walk(),this.atoms.forEach(function(t){t.neighbours=[]},this),n=0;n<d.v_seq.length;n++){var h=d.v_seq[n],m=h.idx,g=h.parent_edge,v=h.parent_vertex;if(g>=0){var b=this.atoms[m],y=d.numOpeningCycles(g);for(a=0;a<y;a++)this.atoms[v].neighbours.push({aid:-1,bid:-1});if(d.edgeClosingCycle(g)){for(c=0;c<b.neighbours.length;c++)if(-1==b.neighbours[c].aid){b.neighbours[c].aid=v,b.neighbours[c].bid=g;break}if(c==b.neighbours.length)throw new Error("internal: can not put closing bond to its place")}else b.neighbours.push({aid:v,bid:g}),b.parent=v;this.atoms[v].neighbours.push({aid:m,bid:g})}}try{var _=new u(t,function(t){return this.atoms[t].neighbours},this);_.buildFromBonds(this.ignore_errors),_.each(function(t,e){var n=-1;-1==e.pyramid[3]&&(n=3);var r=[],o=0,i=this.atoms[t];if(-1!=i.parent)for(c=0;c<4;c++)if(e.pyramid[c]==i.parent){r[o++]=c;break}for(-1!=n&&(r[o++]=n),a=0;a!=i.neighbours.length;a++)if(i.neighbours[a].aid!=i.parent)for(c=0;c<4;c++)if(i.neighbours[a].aid==e.pyramid[c]){if(o>=4)throw new Error("internal: pyramid overflow");r[o++]=c;break}if(4==o)o=r[0],r[0]=r[1],r[1]=r[2],r[2]=r[3],r[3]=o;else if(3!=o)throw new Error("cannot calculate chirality");u.isPyramidMappingRigid(r)?this.atoms[t].chirality=1:this.atoms[t].chirality=2},this)}catch(t){alert("Warning: "+t.message)}var x=[];x.push(0);var w=!0;for(n=0;n<d.v_seq.length;n++){h=d.v_seq[n],m=h.idx,g=h.parent_edge,v=h.parent_vertex;var S=!0;if(v>=0){for(d.numBranches(v)>1&&this.atoms[v].branch_cnt>0&&this.atoms[v].paren_written&&(this.smiles+=")"),y=d.numOpeningCycles(g),a=0;a<y;a++){for(c=1;c<x.length&&-1!=x[c];c++);c==x.length?x.push(v):x[c]=v,this.writeCycleNumber(c)}if(v>=0){var O=d.numBranches(v);if(O>1&&this.atoms[v].branch_cnt<O-1&&(d.edgeClosingCycle(g)?this.atoms[v].paren_written=!1:(this.smiles+="(",this.atoms[v].paren_written=!0)),++this.atoms[v].branch_cnt>O)throw new Error("unexpected branch")}var A=t.bonds.get(g),E=0;if(A.type==i.Bond.PATTERN.TYPE.SINGLE&&(E=this.calcBondDirection(t,g,v)),1==E&&m==A.end||2==E&&m==A.begin?this.smiles+="/":2==E&&m==A.end||1==E&&m==A.begin?this.smiles+="\\":A.type==i.Bond.PATTERN.TYPE.ANY?this.smiles+="~":A.type==i.Bond.PATTERN.TYPE.DOUBLE?this.smiles+="=":A.type==i.Bond.PATTERN.TYPE.TRIPLE?this.smiles+="#":A.type!=i.Bond.PATTERN.TYPE.AROMATIC||this.atoms[A.begin].lowercase&&this.atoms[A.end].lowercase&&this.isBondInRing(g)?A.type==i.Bond.PATTERN.TYPE.SINGLE&&this.atoms[A.begin].aromatic&&this.atoms[A.end].aromatic&&(this.smiles+="-"):this.smiles+=":",d.edgeClosingCycle(g)){for(a=1;a<x.length&&x[a]!=m;a++);if(a==x.length)throw new Error("cycle number not found");this.writeCycleNumber(a),x[a]=-1,S=!1}}else w||(this.smiles+=this.writtenComponents===d.nComponentsInReactants&&0!==d.nReactants?">>":"."),w=!1,this.writtenComponents++;S&&(this.writeAtom(t,m,this.atoms[m].aromatic,this.atoms[m].lowercase,this.atoms[m].chirality),this.writtenAtoms.push(h.idx))}return this.comma=!1,this.writeRadicals(t),this.comma&&(this.smiles+="|"),this.smiles},r.prototype.writeCycleNumber=function(t){if(t>0&&t<10)this.smiles+=t;else if(t>=10&&t<100)this.smiles+="%"+t;else{if(!(t>=100&&t<1e3))throw new Error("bad cycle number: "+t);this.smiles+="%%"+t}},r.prototype.writeAtom=function(t,e,n,r,o){var i=t.atoms.get(e),a=!1,s=-1,u=0;if("A"==i.label)return void(this.smiles+="*");if("R"==i.label||"R#"==i.label)return void(this.smiles+="[*]");u=i.aam,"C"!=i.label&&"P"!=i.label&&"N"!=i.label&&"S"!=i.label&&"O"!=i.label&&"Cl"!=i.label&&"F"!=i.label&&"Br"!=i.label&&"B"!=i.label&&"I"!=i.label&&(a=!0),(i.explicitValence>=0||0!=i.radical||o>0||n&&"C"!=i.label&&"O"!=i.label||n&&"C"==i.label&&this.atoms[e].neighbours.length<3&&0==this.atoms[e].h_count)&&(s=this.atoms[e].h_count);var c=i.label;if(i.atomList&&!i.atomList.notList?(c=i.atomList.label(),a=!1):i.isPseudo()||i.atomList&&i.atomList.notList?(c="*",a=!0):(o||0!=i.charge||i.isotope>0||s>=0||u>0)&&(a=!0),a&&(-1==s&&(s=this.atoms[e].h_count),this.smiles+="["),i.isotope>0&&(this.smiles+=i.isotope),this.smiles+=r?c.toLowerCase():c,o>0&&(this.smiles+=1==o?"@":"@@",i.implicitH>1))throw new Error(i.implicitH+" implicit H near stereocenter");"H"!=i.label&&(s>1||0==s&&!a?this.smiles+="H"+s:1==s&&(this.smiles+="H")),i.charge>1?this.smiles+="+"+i.charge:i.charge<-1?this.smiles+=i.charge:1==i.charge?this.smiles+="+":-1==i.charge&&(this.smiles+="-"),u>0&&(this.smiles+=":"+u),a&&(this.smiles+="]")},r.prototype.markCisTrans=function(t){this.cis_trans=new a(t,function(t){return this.atoms[t].neighbours},this),this.cis_trans.build(),this.dbonds=new Array(t.bonds.count()),t.bonds.each(function(t){this.dbonds[t]={ctbond_beg:-1,ctbond_end:-1,saved:0}},this),this.cis_trans.each(function(e,n){var r=t.bonds.get(e);if(0!=n.parity&&!this.isBondInRing(e)){var o=this.atoms[r.begin].neighbours,a=this.atoms[r.end].neighbours,s=!0,u=!0;if(o.forEach(function(n){n.bid!==e&&t.bonds.get(n.bid).type===i.Bond.PATTERN.TYPE.SINGLE&&(s=!1)},this),a.forEach(function(n){n.bid!==e&&t.bonds.get(n.bid).type===i.Bond.PATTERN.TYPE.SINGLE&&(u=!1)},this),s||u)return;o.forEach(function(n){n.bid!==e&&(t.bonds.get(n.bid).begin===r.begin?this.dbonds[n.bid].ctbond_beg=e:this.dbonds[n.bid].ctbond_end=e)},this),a.forEach(function(n){n.bid!==e&&(t.bonds.get(n.bid).begin===r.end?this.dbonds[n.bid].ctbond_beg=e:this.dbonds[n.bid].ctbond_end=e)},this)}},this)},r.prototype.updateSideBonds=function(t,e){var n=t.bonds.get(e),r=this.cis_trans.getSubstituents(e),o=this.cis_trans.getParity(e),i=[-1,-1,-1,-1];i[0]=t.findBondId(r[0],n.begin),-1!=r[1]&&(i[1]=t.findBondId(r[1],n.begin)),i[2]=t.findBondId(r[2],n.end),-1!=r[3]&&(i[3]=t.findBondId(r[3],n.end));var s=0,u=0,c=0,l=0;if(0!=this.dbonds[i[0]].saved&&(1==this.dbonds[i[0]].saved&&t.bonds.get(i[0]).begin==n.begin||2==this.dbonds[i[0]].saved&&t.bonds.get(i[0]).end==n.begin?s++:u++),-1!=i[1]&&0!=this.dbonds[i[1]].saved&&(2==this.dbonds[i[1]].saved&&t.bonds.get(i[1]).begin==n.begin||1==this.dbonds[i[1]].saved&&t.bonds.get(i[1]).end==n.begin?s++:u++),0!=this.dbonds[i[2]].saved&&(1==this.dbonds[i[2]].saved&&t.bonds.get(i[2]).begin==n.end||2==this.dbonds[i[2]].saved&&t.bonds.get(i[2]).end==n.end?c++:l++),-1!=i[3]&&0!=this.dbonds[i[3]].saved&&(2==this.dbonds[i[3]].saved&&t.bonds.get(i[3]).begin==n.end||1==this.dbonds[i[3]].saved&&t.bonds.get(i[3]).end==n.end?c++:l++),o==a.PARITY.CIS?(s+=c,u+=l):(s+=l,u+=c),s>0&&u>0)throw new Error("incompatible cis-trans configuration");return(0!=s||0!=u)&&(s>0&&(this.dbonds[i[0]].saved=t.bonds.get(i[0]).begin==n.begin?1:2,-1!=i[1]&&(this.dbonds[i[1]].saved=t.bonds.get(i[1]).begin==n.begin?2:1),this.dbonds[i[2]].saved=t.bonds.get(i[2]).begin==n.end==(o==a.PARITY.CIS)?1:2,-1!=i[3]&&(this.dbonds[i[3]].saved=t.bonds.get(i[3]).begin==n.end==(o==a.PARITY.CIS)?2:1)),u>0&&(this.dbonds[i[0]].saved=t.bonds.get(i[0]).begin==n.begin?2:1,-1!=i[1]&&(this.dbonds[i[1]].saved=t.bonds.get(i[1]).begin==n.begin?1:2),this.dbonds[i[2]].saved=t.bonds.get(i[2]).begin==n.end==(o==a.PARITY.CIS)?2:1,-1!=i[3]&&(this.dbonds[i[3]].saved=t.bonds.get(i[3]).begin==n.end==(o==a.PARITY.CIS)?1:2)),!0)},r.prototype.calcBondDirection=function(t,e,n){var r;if(-1==this.dbonds[e].ctbond_beg&&-1==this.dbonds[e].ctbond_end)return 0;if(t.bonds.get(e).type!=i.Bond.PATTERN.TYPE.SINGLE)throw new Error("internal: directed bond type "+t.bonds.get(e).type);for(;;){if(r=0,this.cis_trans.each(function(e,n){0==n.parity||this.isBondInRing(e)||this.updateSideBonds(t,e)&&r++},this),r==this.touchedCistransbonds)break;this.touchedCistransbonds=r}return 0==this.dbonds[e].saved&&(n==t.bonds.get(e).begin?this.dbonds[e].saved=1:this.dbonds[e].saved=2),this.dbonds[e].saved},r.prototype.writeRadicals=function(t){var e,n,r=new Array(this.writtenAtoms.length);for(e=0;e<this.writtenAtoms.length;e++)if(!r[e]){var o=t.atoms.get(this.writtenAtoms[e]).radical;if(0!=o)for(this.comma?this.smiles+=",":(this.smiles+=" |",this.comma=!0),o==i.Atom.PATTERN.RADICAL.SINGLET?this.smiles+="^3:":o==i.Atom.PATTERN.RADICAL.DOUPLET?this.smiles+="^1:":this.smiles+="^4:",this.smiles+=e,n=e+1;n<this.writtenAtoms.length;n++)t.atoms.get(this.writtenAtoms[n]).radical==o&&(r[n]=!0,this.smiles+=","+n)}},e.exports={stringify:function(t,e){var n=e||{};return(new r).saveMolecule(t,n.ignoreErrors)}}},{"../../util/set":656,"../struct":533,"./cis_trans":526,"./dfs":527,"./stereocenters":529}],529:[function(t,e,n){"use strict";function r(t,e,n){this.molecule=t,this.atoms=new i,this.getNeighbors=e,this.context=n}function o(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}var i=t("../../util/map"),a=t("../../util/set"),s=t("../../util/vec2"),u=t("../struct");r.prototype.each=function(t,e){this.atoms.each(t,e)},r.prototype.buildFromBonds=function(t){var e=this.molecule.atoms,n=this.molecule.bonds,r=a.empty();e.each(function(t){var o=this.getNeighbors.call(this.context,t);if(2!=o.length)return!1;var i=o[0],s=o[1];if([t,i.aid,s.aid].findIndex(function(t){return["C","Si"].indexOf(e.get(t).label)<0},this)>=0)return!1;if([i.bid,s.bid].findIndex(function(t){return n.get(t).type!=u.Bond.PATTERN.TYPE.DOUBLE},this)>=0)return!1;var c=this.getNeighbors.call(this.context,i.aid).filter(function(e){return e.aid!=t}),l=this.getNeighbors.call(this.context,s.aid).filter(function(e){return e.aid!=t});return!(c.length<1||c.length>2||l.length<1||l.length>2)&&(!(c.concat(l).findIndex(function(t){return n.get(t.bid).type!=u.Bond.PATTERN.TYPE.SINGLE},this)>=0)&&(!(c.concat(l).findIndex(function(t){return n.get(t.bid).stereo==u.Bond.PATTERN.STEREO.EITHER},this)>=0)&&(a.add(r,i.aid),void a.add(r,s.aid))))},this),a.size(r)>0&&alert("This structure may contain allenes, which cannot be represented in the SMILES notation. Relevant stereo-information will be discarded."),e.each(function(t){if(!a.contains(r,t)){var e=this.getNeighbors.call(this.context,t),n=!1;e.find(function(e){var r=this.molecule.bonds.get(e.bid);return r.type==u.Bond.PATTERN.TYPE.SINGLE&&r.begin==t&&(r.stereo==u.Bond.PATTERN.STEREO.UP||r.stereo==u.Bond.PATTERN.STEREO.DOWN)&&(n=!0,!0)},this),n&&this.buildOneCenter(t)}},this)},r.allowed_stereocenters=[{elem:"C",charge:0,degree:3,n_double_bonds:0,implicit_degree:4},{elem:"C",charge:0,degree:4,n_double_bonds:0,implicit_degree:4},{elem:"Si",charge:0,degree:3,n_double_bonds:0,implicit_degree:4},{elem:"Si",charge:0,degree:4,n_double_bonds:0,implicit_degree:4},{elem:"N",charge:1,degree:3,n_double_bonds:0,implicit_degree:4},{elem:"N",charge:1,degree:4,n_double_bonds:0,implicit_degree:4},{elem:"N",charge:0,degree:3,n_double_bonds:0,implicit_degree:3},{elem:"S",charge:0,degree:4,n_double_bonds:2,implicit_degree:4},{elem:"S",charge:1,degree:3,n_double_bonds:0,implicit_degree:3},{elem:"S",charge:0,degree:3,n_double_bonds:1,implicit_degree:3},{elem:"P",charge:0,degree:3,n_double_bonds:0,implicit_degree:3},{elem:"P",charge:1,degree:4,n_double_bonds:0,implicit_degree:4},{elem:"P",charge:0,degree:4,n_double_bonds:1,implicit_degree:4}],r.prototype.buildOneCenter=function(t){var e=this.molecule.atoms.get(t),n=this.getNeighbors.call(this.context,t),i=n.length,a=-1,c={group:0,type:0,pyramid:[]},l=[],f=0,p=0;c.pyramid[0]=-1,c.pyramid[1]=-1,c.pyramid[2]=-1,c.pyramid[3]=-1;var d=0;if(i>4)throw new Error("stereocenter with %d bonds are not supported"+i);if(n.forEach(function(t,n){var r=this.molecule.atoms.get(t.aid),o=this.molecule.bonds.get(t.bid);if(l[n]={edge_idx:t.bid,nei_idx:t.aid,rank:t.aid,vec:s.diff(r.pp,e.pp).yComplement()},r.pureHydrogen()?(d++,l[n].rank=1e4):"H"===r.label&&(l[n].rank=5e3),!l[n].vec.normalize())throw new Error("zero bond length");if(o.type===u.Bond.PATTERN.TYPE.TRIPLE)throw new Error("non-single bonds not allowed near stereocenter");if(o.type===u.Bond.PATTERN.TYPE.AROMATIC)throw new Error("aromatic bonds not allowed near stereocenter");o.type===u.Bond.PATTERN.TYPE.DOUBLE&&p++},this),r.allowed_stereocenters.find(function(t){return t.elem==e.label&&t.charge==e.charge&&t.degree==i&&t.n_double_bonds==p&&(a=t.implicit_degree,!0)},this),-1===a)throw new Error("unknown stereocenter configuration: "+e.label+", charge "+e.charge+", "+i+" bonds ("+p+" double)");if(4===i&&d>1)throw new Error(d+" hydrogens near stereocenter");if(3===i&&4==a&&d>0)throw new Error("have hydrogen(s) besides implicit hydrogen near stereocenter");if(4===i){l[0].rank>l[1].rank&&o(l,0,1),l[1].rank>l[2].rank&&o(l,1,2),l[2].rank>l[3].rank&&o(l,2,3),l[1].rank>l[2].rank&&o(l,1,2),l[0].rank>l[1].rank&&o(l,0,1),l[1].rank>l[2].rank&&o(l,1,2);for(var h=-1,m=-1,g=-1,v=-1,b=0,y=0;y<4;y++){var _=this.getBondStereo(t,l[y].edge_idx);if(_==u.Bond.PATTERN.STEREO.UP||_==u.Bond.PATTERN.STEREO.DOWN){h=y,b=_;break}}if(-1==h)throw new Error("none of 4 bonds going from stereocenter is stereobond");var x,w;if(-1==m&&(x=r.xyzzy(l[h].vec,l[(h+1)%4].vec,l[(h+2)%4].vec),w=r.xyzzy(l[h].vec,l[(h+1)%4].vec,l[(h+3)%4].vec),x+w!=3&&x+w!=12||(m=(h+1)%4,g=(h+2)%4,v=(h+3)%4)),-1==m&&(x=r.xyzzy(l[h].vec,l[(h+2)%4].vec,l[(h+1)%4].vec),w=r.xyzzy(l[h].vec,l[(h+2)%4].vec,l[(h+3)%4].vec),x+w!=3&&x+w!=12||(m=(h+2)%4,g=(h+1)%4,v=(h+3)%4)),-1==m&&(x=r.xyzzy(l[h].vec,l[(h+3)%4].vec,l[(h+1)%4].vec),w=r.xyzzy(l[h].vec,l[(h+3)%4].vec,l[(h+2)%4].vec),x+w!=3&&x+w!=12||(m=(h+3)%4,g=(h+2)%4,v=(h+1)%4)),-1==m)throw new Error("internal error: can not find opposite bond");if(b==u.Bond.PATTERN.STEREO.UP&&this.getBondStereo(t,l[m].edge_idx)==u.Bond.PATTERN.STEREO.DOWN)throw new Error("stereo types of the opposite bonds mismatch");if(b==u.Bond.PATTERN.STEREO.DOWN&&this.getBondStereo(t,l[m].edge_idx)==u.Bond.PATTERN.STEREO.UP)throw new Error("stereo types of the opposite bonds mismatch");if(b==this.getBondStereo(t,l[g].edge_idx))throw new Error("stereo types of non-opposite bonds match");if(b==this.getBondStereo(t,l[v].edge_idx))throw new Error("stereo types of non-opposite bonds match");f=3==h||3==m?b:b==u.Bond.PATTERN.STEREO.UP?u.Bond.PATTERN.STEREO.DOWN:u.Bond.PATTERN.STEREO.UP,T=r.sign(l[0].vec,l[1].vec,l[2].vec),f==u.Bond.PATTERN.STEREO.UP&&T>0||f==u.Bond.PATTERN.STEREO.DOWN&&T<0?(c.pyramid[0]=l[0].nei_idx,c.pyramid[1]=l[1].nei_idx,c.pyramid[2]=l[2].nei_idx):(c.pyramid[0]=l[0].nei_idx,c.pyramid[1]=l[2].nei_idx,c.pyramid[2]=l[1].nei_idx),c.pyramid[3]=l[3].nei_idx}else if(3===i){l[0].rank>l[1].rank&&o(l,0,1),l[1].rank>l[2].rank&&o(l,1,2),l[0].rank>l[1].rank&&o(l,0,1);var S=this.getBondStereo(t,l[0].edge_idx),O=this.getBondStereo(t,l[1].edge_idx),A=this.getBondStereo(t,l[2].edge_idx),E=0,j=0;if(E+=S===u.Bond.PATTERN.STEREO.UP?1:0,E+=O===u.Bond.PATTERN.STEREO.UP?1:0,E+=A===u.Bond.PATTERN.STEREO.UP?1:0,j+=S===u.Bond.PATTERN.STEREO.DOWN?1:0,j+=O===u.Bond.PATTERN.STEREO.DOWN?1:0,j+=A===u.Bond.PATTERN.STEREO.DOWN?1:0,4==a){if(3==E)throw new Error("all 3 bonds up near stereoatom");if(3==j)throw new Error("all 3 bonds down near stereoatom");if(0==E&&0==j)throw new Error("no up/down bonds near stereoatom -- indefinite case");if(1==E&&1==j)throw new Error("one bond up, one bond down -- indefinite case");if(b=0,2==E)f=u.Bond.PATTERN.STEREO.DOWN;else if(2==j)f=u.Bond.PATTERN.STEREO.UP;else{for(h=-1,g=-1,v=-1,y=0;y<3;y++)if((C=this.getBondStereo(t,l[y].edge_idx))==u.Bond.PATTERN.STEREO.UP||C==u.Bond.PATTERN.STEREO.DOWN){h=y,b=C,g=(y+1)%3,v=(y+2)%3;break}if(-1==h)throw new Error("internal error: can not find up or down bond");var P=r.xyzzy(l[g].vec,l[v].vec,l[h].vec);if(3==P||4==P)throw new Error("degenerate case for 3 bonds near stereoatom");f=1==P?b:b==u.Bond.PATTERN.STEREO.UP?u.Bond.PATTERN.STEREO.DOWN:u.Bond.PATTERN.STEREO.UP}var T=r.sign(l[0].vec,l[1].vec,l[2].vec);f==u.Bond.PATTERN.STEREO.UP&&T>0||f==u.Bond.PATTERN.STEREO.DOWN&&T<0?(c.pyramid[0]=l[0].nei_idx,c.pyramid[1]=l[1].nei_idx,c.pyramid[2]=l[2].nei_idx):(c.pyramid[0]=l[0].nei_idx,c.pyramid[1]=l[2].nei_idx,c.pyramid[2]=l[1].nei_idx),c.pyramid[3]=-1}else{var C;if(j>0&&E>0)throw new Error("one bond up, one bond down -- indefinite case");if(0==j&&0==E)throw new Error("no up-down bonds attached to stereocenter");C=E>0?1:-1,1!==r.xyzzy(l[0].vec,l[1].vec,l[2].vec)&&1!==r.xyzzy(l[0].vec,l[2].vec,l[1].vec)&&1!==r.xyzzy(l[2].vec,l[1].vec,l[0].vec)||(C=-C),T=r.sign(l[0].vec,l[1].vec,l[2].vec),T==C?(c.pyramid[0]=l[0].nei_idx,c.pyramid[1]=l[2].nei_idx,c.pyramid[2]=l[1].nei_idx):(c.pyramid[0]=l[0].nei_idx,c.pyramid[1]=l[1].nei_idx,c.pyramid[2]=l[2].nei_idx),c.pyramid[3]=-1}}this.atoms.set(t,c)},r.prototype.getBondStereo=function(t,e){var n=this.molecule.bonds.get(e);return t!=n.begin?0:n.stereo},r.xyzzy=function(t,e,n){var r=s.cross(t,e),o=s.dot(t,e),i=s.cross(t,n),a=s.dot(t,n);if(Math.abs(r)<.001){if(Math.abs(i)<.001)throw new Error("degenerate case -- bonds overlap");return i>0?4:8}return r*i<-1e-6?2:a<o?2:1},r.sign=function(t,e,n){var r=(t.x-n.x)*(e.y-n.y)-(t.y-n.y)*(e.x-n.x);if(r>.001)return 1;if(r<-.001)return-1;throw new Error("degenerate triangle")},r.isPyramidMappingRigid=function(t){var e=t.slice(),n=!0;return e[0]>e[1]&&(o(e,0,1),n=!n),e[1]>e[2]&&(o(e,1,2),n=!n),e[2]>e[3]&&(o(e,2,3),n=!n),e[1]>e[2]&&(o(e,1,2),n=!n),e[0]>e[1]&&(o(e,0,1),n=!n),e[1]>e[2]&&(o(e,1,2),n=!n),n},e.exports=r},{"../../util/map":653,"../../util/set":656,"../../util/vec2":657,"../struct":533}],530:[function(t,e,n){"use strict";function r(t){var e=r.attrGetDefault;console.assert(t||"label"in t,"label must be specified!"),this.label=t.label,this.fragment="fragment"in t?t.fragment:-1,this.pseudo=t.pseudo||a(t.label),i(this,t,"alias",e("alias")),i(this,t,"isotope",e("isotope")),i(this,t,"radical",e("radical")),i(this,t,"charge",e("charge")),i(this,t,"rglabel",e("rglabel")),i(this,t,"attpnt",e("attpnt")),i(this,t,"explicitValence",e("explicitValence")),this.valence=0,this.implicitH=0,this.pp=t.pp?new s(t.pp):new s,this.sgs={},i(this,t,"ringBondCount",e("ringBondCount")),i(this,t,"substitutionCount",e("substitutionCount")),i(this,t,"unsaturatedAtom",e("unsaturatedAtom")),i(this,t,"hCount",e("hCount")),i(this,t,"aam",e("aam")),i(this,t,"invRet",e("invRet")),i(this,t,"exactChangeFlag",e("exactChangeFlag")),i(this,t,"rxnFragmentType",-1),this.atomList=t.atomList?new c(t.atomList):null,this.neighbors=[],this.badConn=!1}function o(t){return(t-=0)===r.PATTERN.RADICAL.NONE?0:t===r.PATTERN.RADICAL.DOUPLET?1:t===r.PATTERN.RADICAL.SINGLET||t===r.PATTERN.RADICAL.TRIPLET?2:void console.assert(!1,"Unknown radical value")}function i(t,e,n,r){t[n]=void 0!==e[n]?e[n]:r}function a(t){return u.map[t]||"L"===t||"L#"===t||"R#"===t?null:t}var s=t("../../util/vec2"),u=t("../element"),c=t("./atomlist");r.getAttrHash=function(t){var e={};for(var n in r.attrlist)void 0!==t[n]&&(e[n]=t[n]);return e},r.attrGetDefault=function(t){if(t in r.attrlist)return r.attrlist[t];console.assert(!1,"Attribute unknown")},r.PATTERN={RADICAL:{NONE:0,SINGLET:1,DOUPLET:2,TRIPLET:3}},r.attrlist={alias:null,label:"C",pseudo:null,isotope:0,radical:0,charge:0,explicitValence:-1,ringBondCount:0,substitutionCount:0,unsaturatedAtom:0,hCount:0,atomList:null,invRet:0,exactChangeFlag:0,rglabel:null,attpnt:null,aam:0},r.prototype.clone=function(t){var e=new r(this);return t&&this.fragment in t&&(e.fragment=t[this.fragment]),e},r.prototype.isQuery=function(){return null!=this.atomList||"A"===this.label||this.attpnt||this.hCount},r.prototype.pureHydrogen=function(){return"H"===this.label&&0===this.isotope},r.prototype.isPlainCarbon=function(){return"C"===this.label&&0===this.isotope&&0==this.radical&&0==this.charge&&this.explicitValence<0&&0==this.ringBondCount&&0==this.substitutionCount&&0==this.unsaturatedAtom&&0==this.hCount&&!this.atomList},r.prototype.isPseudo=function(){return!this.atomList&&!this.rglabel&&!u.map[this.label]},r.prototype.hasRxnProps=function(){return!!(this.invRet||this.exactChangeFlag||null!=this.attpnt||this.aam)},r.prototype.calcValence=function(t){var e=this,n=e.charge,r=e.label;if(e.isQuery())return this.implicitH=0,!0;var i=u.map[r];if(void 0===i)return this.implicitH=0,!0;var a=u[i].group,s=o(e.radical),c=t,l=0,f=Math.abs(n);return 1===a?"H"!==r&&"Li"!==r&&"Na"!==r&&"K"!==r&&"Rb"!==r&&"Cs"!==r&&"Fr"!==r||(c=1,l=1-s-t-f):2===a?t+s+f===2||t+s+f===0?c=2:l=-1:3===a?"B"===r||"Al"===r||"Ga"===r||"In"===r?-1===n?(c=4,l=4-s-t):(c=3,l=3-s-t-f):"Tl"===r&&(-1===n?s+t<=2?(c=2,l=2-s-t):(c=4,l=4-s-t):-2===n?s+t<=3?(c=3,l=3-s-t):(c=5,l=5-s-t):s+t+f<=1?(c=1,l=1-s-t-f):(c=3,l=3-s-t-f)):4===a?"C"===r||"Si"===r||"Ge"===r?(c=4,l=4-s-t-f):"Sn"!==r&&"Pb"!==r||(t+s+f<=2?(c=2,l=2-s-t-f):(c=4,l=4-s-t-f)):5===a?"N"===r||"P"===r?1===n?(c=4,l=4-s-t):2===n?(c=3,l=3-s-t):"N"===r||s+t+f<=3?(c=3,l=3-s-t-f):(c=5,l=5-s-t-f):"Bi"!==r&&"Sb"!==r&&"As"!==r||(1===n?s+t<=2&&"As"!==r?(c=2,l=2-s-t):(c=4,l=4-s-t):2===n?(c=3,l=3-s-t):s+t<=3?(c=3,l=3-s-t-f):(c=5,l=5-s-t-f)):6===a?"O"===r?n>=1?(c=3,l=3-s-t):(c=2,l=2-s-t-f):"S"===r||"Se"===r||"Po"===r?1===n?t<=3?(c=3,l=3-s-t):(c=5,l=5-s-t):t+s+f<=2?(c=2,l=2-s-t-f):t+s+f<=4?(c=4,l=4-s-t-f):(c=6,l=6-s-t-f):"Te"===r&&(-1===n?t<=2&&(c=2,l=2-s-t-f):0!==n&&2!==n||(t<=2?(c=2,l=2-s-t-f):t<=4?(c=4,l=4-s-t-f):0===n&&t<=6?(c=6,l=6-s-t-f):l=-1)):7===a?"F"===r?(c=1,l=1-s-t-f):"Cl"!==r&&"Br"!==r&&"I"!==r&&"At"!==r||(1===n?t<=2?(c=2,l=2-s-t):(3===t||5===t||t>=7)&&(l=-1):0===n&&(t<=1?(c=1,l=1-s-t):2===t||4===t||6===t?1===s?(c=t,l=0):l=-1:t>7&&(l=-1))):8===a&&(t+s+f===0?c=1:l=-1),this.valence=c,this.implicitH=l,!(this.implicitH<0)||(this.valence=t,this.implicitH=0,this.badConn=!0,!1)},r.prototype.calcValenceMinusHyd=function(t){var e=this,n=e.charge,r=e.label,i=u.map[r];if(null===i&&console.assert("Element "+r+" unknown"),i<0)return this.implicitH=0,null;var a=u[i].group,s=o(e.radical);if(3===a){if(("B"===r||"Al"===r||"Ga"===r||"In"===r)&&-1===n&&s+t<=4)return s+t}else if(5===a){if("N"===r||"P"===r){if(1===n)return s+t;if(2===n)return s+t}else if("Sb"===r||"Bi"===r||"As"===r){if(1===n)return s+t;if(2===n)return s+t}}else if(6===a){if("O"===r){if(n>=1)return s+t}else if(("S"===r||"Se"===r||"Po"===r)&&1===n)return s+t}else if(7===a&&("Cl"===r||"Br"===r||"I"===r||"At"===r)&&1===n)return s+t;return s+t+Math.abs(n)},e.exports=r},{"../../util/vec2":657,"../element":516,"./atomlist":531}],531:[function(t,e,n){"use strict";function r(t){console.assert(t&&"notList"in t&&"ids"in t,"'notList' and 'ids' must be specified!"),this.notList=t.notList,this.ids=t.ids}var o=t("../element");r.prototype.labelList=function(){for(var t=[],e=0;e<this.ids.length;++e)t.push(o[this.ids[e]].label);return t},r.prototype.label=function(){var t="["+this.labelList().join(",")+"]";return this.notList&&(t="!"+t),t},r.prototype.equals=function(t){return this.notList==t.notList&&(this.ids||[]).sort().toString()===(t.ids||[]).sort().toString()},e.exports=r},{"../element":516}],532:[function(t,e,n){"use strict";function r(t){console.assert(t&&"begin"in t&&"end"in t&&"type"in t,"'begin', 'end' and 'type' properties must be specified!"),this.begin=t.begin,this.end=t.end,this.type=t.type,this.xxx=t.xxx||"",this.stereo=r.PATTERN.STEREO.NONE,this.topology=r.PATTERN.TOPOLOGY.EITHER,this.reactingCenterStatus=0,this.hb1=null,this.hb2=null,this.len=0,this.sb=0,this.sa=0,this.angle=0,t.stereo&&(this.stereo=t.stereo),t.topology&&(this.topology=t.topology),t.reactingCenterStatus&&(this.reactingCenterStatus=t.reactingCenterStatus),this.center=new o}var o=t("../../util/vec2");r.PATTERN={TYPE:{SINGLE:1,DOUBLE:2,TRIPLE:3,AROMATIC:4,SINGLE_OR_DOUBLE:5,SINGLE_OR_AROMATIC:6,DOUBLE_OR_AROMATIC:7,ANY:8},STEREO:{NONE:0,UP:1,EITHER:4,DOWN:6,CIS_TRANS:3},TOPOLOGY:{EITHER:0,RING:1,CHAIN:2},REACTING_CENTER:{NOT_CENTER:-1,UNMARKED:0,CENTER:1,UNCHANGED:2,MADE_OR_BROKEN:4,ORDER_CHANGED:8,MADE_OR_BROKEN_AND_CHANGED:12}},r.attrlist={type:r.PATTERN.TYPE.SINGLE,stereo:r.PATTERN.STEREO.NONE,topology:r.PATTERN.TOPOLOGY.EITHER,reactingCenterStatus:0},r.getAttrHash=function(t){var e={};for(var n in r.attrlist)void 0!==t[n]&&(e[n]=t[n]);return e},r.attrGetDefault=function(t){if(t in r.attrlist)return r.attrlist[t];console.error("Attribute unknown")},r.prototype.hasRxnProps=function(){return!!this.reactingCenterStatus},r.prototype.getCenter=function(t){var e=t.atoms.get(this.begin).pp,n=t.atoms.get(this.end).pp;return o.lc2(e,.5,n,.5)},r.prototype.getDir=function(t){var e=t.atoms.get(this.begin).pp;return t.atoms.get(this.end).pp.sub(e).normalized()},r.prototype.clone=function(t){var e=new r(this);return t&&(e.begin=t[e.begin],e.end=t[e.end]),e},r.prototype.findOtherEnd=function(t){return t==this.begin?this.end:t==this.end?this.begin:void console.error("bond end not found")},e.exports=r},{"../../util/vec2":657}],533:[function(t,e,n){"use strict";function r(){this.atoms=new l,this.bonds=new l,this.sgroups=new l,this.halfBonds=new c,this.loops=new l,this.isChiral=!1,this.isReaction=!1,this.rxnArrows=new l,this.rxnPluses=new l,this.frags=new l,this.rgroups=new c,this.name="",this.sGroupForest=new y(this)}
function o(t,e,n){console.assert(3===arguments.length,"Invalid parameter number!"),this.begin=t-0,this.end=e-0,this.bid=n-0,this.dir=new p,this.norm=new p,this.ang=0,this.p=new p,this.loop=-1,this.contra=-1,this.next=-1,this.leftSin=0,this.leftCos=0,this.leftNeighbor=0,this.rightSin=0,this.rightCos=0,this.rightNeighbor=0}function i(t,e,n){this.hbs=t,this.dblBonds=0,this.aromatic=!0,this.convex=n||!1,t.forEach(function(t){var n=e.bonds.get(e.halfBonds.get(t).bid);n.type!=g.PATTERN.TYPE.AROMATIC&&(this.aromatic=!1),n.type==g.PATTERN.TYPE.DOUBLE&&this.dblBonds++},this)}function a(t){t=t||{},this.pp=t.pp?new p(t.pp):new p}function s(t){t=t||{},this.pp=t.pp?new p(t.pp):new p}function u(t,e){for(var n=0;n<t.length;++n)if(t[n]===e)return!1;return t.push(e),!0}var c=t("../../util/map"),l=t("../../util/pool"),f=t("../../util/set"),p=t("../../util/vec2"),d=t("../element"),h=t("./atom"),m=t("./atomlist"),g=t("./bond"),v=t("./sgroup"),b=t("./rgroup"),y=t("./sgforest");r.prototype.hasRxnProps=function(){return this.atoms.find(function(t,e){return e.hasRxnProps()},this)>=0||this.bonds.find(function(t,e){return e.hasRxnProps()},this)>=0},r.prototype.hasRxnArrow=function(){return this.rxnArrows.count()>0},r.prototype.getSGroupsInAtomSet=function(t){var e={};t.forEach(function(t){f.list(this.atoms.get(t).sgs).forEach(function(t){e[t]=e[t]?e[t]+1:1},this)},this);var n=[];for(var r in e){var o=parseInt(r,10),i=this.sgroups.get(o),a=v.getAtoms(this,i);e[r]===a.length&&n.push(o)}return n},r.prototype.isBlank=function(){return 0===this.atoms.count()&&0===this.rxnArrows.count()&&0===this.rxnPluses.count()&&!this.isChiral},r.prototype.toLists=function(){var t={},e=[];this.atoms.each(function(n,r){t[n]=e.length,e.push(r)});var n=[];return this.bonds.each(function(e,r){var o=new g(r);o.begin=t[r.begin],o.end=t[r.end],n.push(o)}),{atoms:e,bonds:n}},r.prototype.clone=function(t,e,n,o){var i=new r;return this.mergeInto(i,t,e,n,!1,o)},r.prototype.getScaffold=function(){var t=f.empty();return this.atoms.each(function(e){f.add(t,e)},this),this.rgroups.each(function(e,n){n.frags.each(function(e,n){this.atoms.each(function(e,r){r.fragment===n&&f.remove(t,e)},this)},this)},this),this.clone(t)},r.prototype.getFragmentIds=function(t){var e=f.empty();return this.atoms.each(function(n,r){r.fragment===t&&f.add(e,n)}),e},r.prototype.getFragment=function(t){return this.clone(this.getFragmentIds(t))},r.prototype.mergeInto=function(t,e,n,r,o,i){e=e||f.keySetInt(this.atoms),n=n||f.keySetInt(this.bonds),n=f.filter(n,function(t){var n=this.bonds.get(t);return f.contains(e,n.begin)&&f.contains(e,n.end)},this);var a={};this.atoms.each(function(t,n){f.contains(e,t)&&(a[n.fragment]=1)});var s={};this.frags.each(function(e,n){a[e]&&(s[e]=t.frags.add(Object.assign({},n)))});var u=[];this.rgroups.each(function(e,n){var r=o;if(r||(n.frags.each(function(t,e){u.push(e),a[e]&&(r=!0)}),r)){var i=t.rgroups.get(e);i?n.frags.each(function(t,e){u.push(e),a[e]&&i.frags.add(s[e])}):t.rgroups.set(e,n.clone(s))}}),void 0!==i&&null!==i||(i={}),this.atoms.each(function(n,r){f.contains(e,n)&&-1===u.indexOf(r.fragment)&&(i[n]=t.atoms.add(r.clone(s)))}),this.atoms.each(function(n,r){f.contains(e,n)&&-1!==u.indexOf(r.fragment)&&(i[n]=t.atoms.add(r.clone(s)))});var c={};return this.bonds.each(function(e,r){f.contains(n,e)&&(c[e]=t.bonds.add(r.clone(i)))}),this.sgroups.each(function(n,r){var o;for(o=0;o<r.atoms.length;++o)if(!f.contains(e,r.atoms[o]))return;r=v.clone(r,i,c);var a=t.sgroups.add(r);for(r.id=a,o=0;o<r.atoms.length;++o)f.add(t.atoms.get(r.atoms[o]).sgs,a);"DAT"===r.type?t.sGroupForest.insert(r.id,-1,[]):t.sGroupForest.insert(r.id)}),t.isChiral=this.isChiral,r||(t.isReaction=this.isReaction,this.rxnArrows.each(function(e,n){t.rxnArrows.add(n.clone())}),this.rxnPluses.each(function(e,n){t.rxnPluses.add(n.clone())})),t},r.prototype.findBondId=function(t,e){var n=-1;return this.bonds.find(function(r,o){return(o.begin===t&&o.end===e||o.begin===e&&o.end===t)&&(n=r,!0)},this),n},r.prototype.initNeighbors=function(){this.atoms.each(function(t,e){e.neighbors=[]}),this.bonds.each(function(t,e){var n=this.atoms.get(e.begin),r=this.atoms.get(e.end);n.neighbors.push(e.hb1),r.neighbors.push(e.hb2)},this)},r.prototype.bondInitHalfBonds=function(t,e){e=e||this.bonds.get(t),e.hb1=2*t,e.hb2=2*t+1,this.halfBonds.set(e.hb1,new o(e.begin,e.end,t)),this.halfBonds.set(e.hb2,new o(e.end,e.begin,t));var n=this.halfBonds.get(e.hb1),r=this.halfBonds.get(e.hb2);n.contra=e.hb2,r.contra=e.hb1},r.prototype.halfBondUpdate=function(t){var e=this.halfBonds.get(t),n=this.atoms.get(e.begin).pp,r=this.atoms.get(e.end).pp,o=p.diff(r,n).normalized();e.dir=p.dist(r,n)>1e-4?o:new p(1,0),e.norm=e.dir.turnLeft(),e.ang=e.dir.oxAngle(),e.loop<0&&(e.loop=-1)},r.prototype.initHalfBonds=function(){this.halfBonds.clear(),this.bonds.each(this.bondInitHalfBonds,this)},r.prototype.setHbNext=function(t,e){this.halfBonds.get(this.halfBonds.get(t).contra).next=e},r.prototype.halfBondSetAngle=function(t,e){var n=this.halfBonds.get(t),r=this.halfBonds.get(e);r.rightCos=n.leftCos=p.dot(r.dir,n.dir),r.rightSin=n.leftSin=p.cross(r.dir,n.dir),n.leftNeighbor=e,r.rightNeighbor=t},r.prototype.atomAddNeighbor=function(t){var e=this.halfBonds.get(t),n=this.atoms.get(e.begin),r=0;for(r=0;r<n.neighbors.length&&!(this.halfBonds.get(n.neighbors[r]).ang>e.ang);++r);n.neighbors.splice(r,0,t);var o=n.neighbors[(r+1)%n.neighbors.length],i=n.neighbors[(r+n.neighbors.length-1)%n.neighbors.length];this.setHbNext(i,t),this.setHbNext(t,o),this.halfBondSetAngle(t,i),this.halfBondSetAngle(o,t)},r.prototype.atomSortNeighbors=function(t){var e=this.atoms.get(t),n=this.halfBonds;e.neighbors=e.neighbors.sort(function(t,e){return n.get(t).ang-n.get(e).ang});var r;for(r=0;r<e.neighbors.length;++r)this.halfBonds.get(this.halfBonds.get(e.neighbors[r]).contra).next=e.neighbors[(r+1)%e.neighbors.length];for(r=0;r<e.neighbors.length;++r)this.halfBondSetAngle(e.neighbors[(r+1)%e.neighbors.length],e.neighbors[r])},r.prototype.sortNeighbors=function(t){function e(t){this.atomSortNeighbors(t)}t?t.forEach(e,this):this.atoms.each(e,this)},r.prototype.atomUpdateHalfBonds=function(t){for(var e=this.atoms.get(t).neighbors,n=0;n<e.length;++n){var r=e[n];this.halfBondUpdate(r),this.halfBondUpdate(this.halfBonds.get(r).contra)}},r.prototype.updateHalfBonds=function(t){function e(t){this.atomUpdateHalfBonds(t)}t?t.forEach(e,this):this.atoms.each(e,this)},r.prototype.sGroupsRecalcCrossBonds=function(){this.sgroups.each(function(t,e){e.xBonds=[],e.neiAtoms=[]},this),this.bonds.each(function(t,e){var n=this.atoms.get(e.begin),r=this.atoms.get(e.end);f.each(n.sgs,function(n){if(!f.contains(r.sgs,n)){var o=this.sgroups.get(n);o.xBonds.push(t),u(o.neiAtoms,e.end)}},this),f.each(r.sgs,function(r){if(!f.contains(n.sgs,r)){var o=this.sgroups.get(r);o.xBonds.push(t),u(o.neiAtoms,e.begin)}},this)},this)},r.prototype.sGroupDelete=function(t){for(var e=this.sgroups.get(t),n=0;n<e.atoms.length;++n)f.remove(this.atoms.get(e.atoms[n]).sgs,t);this.sGroupForest.remove(t),this.sgroups.remove(t)},r.prototype.atomSetPos=function(t,e){this.atoms.get(t).pp=e},r.prototype.rxnPlusSetPos=function(t,e){this.rxnPluses.get(t).pp=e},r.prototype.rxnArrowSetPos=function(t,e){this.rxnArrows.get(t).pp=e},r.prototype.getCoordBoundingBox=function(t){function e(t){n?(n.min=p.min(n.min,t),n.max=p.max(n.max,t)):n={min:t,max:t}}var n=null,r=void 0===t;return this.atoms.each(function(n,o){(r||f.contains(t,n))&&e(o.pp)}),r&&(this.rxnPluses.each(function(t,n){e(n.pp)}),this.rxnArrows.each(function(t,n){e(n.pp)})),!n&&r&&(n={min:new p(0,0),max:new p(1,1)}),n},r.prototype.getCoordBoundingBoxObj=function(){function t(t){e?(e.min=p.min(e.min,t),e.max=p.max(e.max,t)):e={min:new p(t),max:new p(t)}}var e=null;return this.atoms.each(function(e,n){t(n.pp)}),e},r.prototype.getBondLengthData=function(){var t=0,e=0;return this.bonds.each(function(n,r){t+=p.dist(this.atoms.get(r.begin).pp,this.atoms.get(r.end).pp),e++},this),{cnt:e,totalLength:t}},r.prototype.getAvgBondLength=function(){var t=this.getBondLengthData();return t.cnt>0?t.totalLength/t.cnt:-1},r.prototype.getAvgClosestAtomDistance=function(){var t,e,n,r=0,o=0,i=this.atoms.keys();for(e=0;e<i.length;++e){for(t=-1,n=0;n<i.length;++n)n!=e&&(o=p.dist(this.atoms.get(i[n]).pp,this.atoms.get(i[e]).pp),(t<0||t>o)&&(t=o));r+=t}return i.length>0?r/i.length:-1},r.prototype.checkBondExists=function(t,e){var n=!1;return this.bonds.each(function(r,o){(o.begin==t&&o.end==e||o.end==t&&o.begin==e)&&(n=!0)},this),n},r.prototype.findConnectedComponent=function(t){for(var e={},n=[t],r=f.empty();n.length>0;)(function(){var t=n.pop();e[t]=1,f.add(r,t);for(var o=this.atoms.get(t),i=0;i<o.neighbors.length;++i){var a=this.halfBonds.get(o.neighbors[i]).end;f.contains(r,a)||n.push(a)}}).apply(this);return r},r.prototype.findConnectedComponents=function(t){this.halfBonds.count()||(this.initHalfBonds(),this.initNeighbors(),this.updateHalfBonds(this.atoms.keys()),this.sortNeighbors(this.atoms.keys()));var e={};this.atoms.each(function(t){e[t]=-1},this);var n=[];return this.atoms.each(function(r,o){if((t||o.fragment<0)&&e[r]<0){var i=this.findConnectedComponent(r);n.push(i),f.each(i,function(t){e[t]=1},this)}},this),n},r.prototype.markFragment=function(t){var e={},n=this.frags.add(e);f.each(t,function(t){this.atoms.get(t).fragment=n},this)},r.prototype.markFragmentByAtomId=function(t){this.markFragment(this.findConnectedComponent(t))},r.prototype.markFragments=function(){for(var t=this.findConnectedComponents(),e=0;e<t.length;++e)this.markFragment(t[e])},r.prototype.scale=function(t){1!=t&&(this.atoms.each(function(e,n){n.pp=n.pp.scaled(t)},this),this.rxnPluses.each(function(e,n){n.pp=n.pp.scaled(t)},this),this.rxnArrows.each(function(e,n){n.pp=n.pp.scaled(t)},this),this.sgroups.each(function(e,n){n.pp=n.pp?n.pp.scaled(t):null},this))},r.prototype.rescale=function(){var t=this.getAvgBondLength();t<0&&!this.isReaction&&(t=this.getAvgClosestAtomDistance()),t<.001&&(t=1);var e=1/t;this.scale(e)},r.prototype.loopHasSelfIntersections=function(t){for(var e=0;e<t.length;++e)for(var n=this.halfBonds.get(t[e]),r=this.atoms.get(n.begin).pp,o=this.atoms.get(n.end).pp,i=f.fromList([n.begin,n.end]),a=e+2;a<t.length;++a){var s=this.halfBonds.get(t[a]);if(!f.contains(i,s.begin)&&!f.contains(i,s.end)){var u=this.atoms.get(s.begin).pp,c=this.atoms.get(s.end).pp;if(p.segmentIntersection(r,o,u,c))return!0}}return!1},r.prototype.partitionLoop=function(t){var e=[],n=!0;t:for(;n;){for(var r={},o=0;o<t.length;++o){var i=t[o],a=this.halfBonds.get(i).begin,s=this.halfBonds.get(i).end;if(s in r){var u=r[s],c=t.slice(u,o+1);e.push(c),o<t.length&&t.splice(u,o-u+1);continue t}r[a]=o}n=!1,e.push(t)}return e},r.prototype.halfBondAngle=function(t,e){var n=this.halfBonds.get(t),r=this.halfBonds.get(e);return Math.atan2(p.cross(n.dir,r.dir),p.dot(n.dir,r.dir))},r.prototype.loopIsConvex=function(t){for(var e=0;e<t.length;++e){if(this.halfBondAngle(t[e],t[(e+1)%t.length])>0)return!1}return!0},r.prototype.loopIsInner=function(t){for(var e=2*Math.PI,n=0;n<t.length;++n){var r=t[n],o=t[(n+1)%t.length],i=this.halfBonds.get(o),a=this.halfBondAngle(r,o);i.contra==t[n]?e+=Math.PI:e+=a}return Math.abs(e)<Math.PI},r.prototype.findLoops=function(){var t,e,n,r,o=[],a=f.empty();return this.halfBonds.each(function(s,u){if(-1===u.loop)for(t=s,e=0,n=[];e<=this.halfBonds.count();t=this.halfBonds.get(t).next,++e){if(e>0&&t===s){var c=this.partitionLoop(n);c.forEach(function(t){this.loopIsInner(t)&&!this.loopHasSelfIntersections(t)?(r=Math.min.apply(Math,t),this.loops.set(r,new i(t,this,this.loopIsConvex(t)))):r=-2,t.forEach(function(t){this.halfBonds.get(t).loop=r,f.add(a,this.halfBonds.get(t).bid)},this),r>=0&&o.push(r)},this);break}n.push(t)}},this),{newLoops:o,bondsToMark:f.list(a)}},r.prototype.prepareLoopStructure=function(){this.initHalfBonds(),this.initNeighbors(),this.updateHalfBonds(this.atoms.keys()),this.sortNeighbors(this.atoms.keys()),this.findLoops()},r.prototype.atomAddToSGroup=function(t,e){v.addAtom(this.sgroups.get(t),e),f.add(this.atoms.get(e).sgs,t)},r.prototype.calcConn=function(t){for(var e=0,n=this.atoms.get(t),r=!1,o=!1,i=0;i<n.neighbors.length;++i){var a=this.halfBonds.get(n.neighbors[i]);switch(this.bonds.get(a.bid).type){case g.PATTERN.TYPE.SINGLE:e+=1;break;case g.PATTERN.TYPE.DOUBLE:e+=2;break;case g.PATTERN.TYPE.TRIPLE:e+=3;break;case g.PATTERN.TYPE.AROMATIC:e+=1,o=!0,this.loops.each(function(t,e){-1!=e.hbs.indexOf(n.neighbors[i])&&e.hbs.length%2==1&&(r=!0)},this);break;default:return-1}}return!o||n.hasImplicitH||r||(e+=1),e},r.prototype.calcImplicitHydrogen=function(t){var e=this.calcConn(t),n=this.atoms.get(t);if(n.badConn=!1,e<0||n.isQuery())return void(n.implicitH=0);if(n.explicitValence>=0){var r=d.map[n.label];n.implicitH=0,null!=r&&(n.implicitH=n.explicitValence-n.calcValenceMinusHyd(e),n.implicitH<0&&(n.implicitH=0,n.badConn=!0))}else n.calcValence(e)},r.prototype.setImplicitHydrogen=function(t){function e(t){this.calcImplicitHydrogen(t)}this.sgroups.each(function(t,e){"MRV_IMPLICIT_H"===e.data.fieldName&&(this.atoms.get(e.atoms[0]).hasImplicitH=!0)},this),t?t.forEach(e,this):this.atoms.each(e,this)},r.prototype.getComponents=function(){var t=this.findConnectedComponents(!0),e=[],n=null;this.rxnArrows.each(function(t,e){n=e.pp.x}),this.rxnPluses.each(function(t,n){e.push(n.pp.x)}),null!=n&&e.push(n),e.sort(function(t,e){return t-e});var r,o=[];for(r=0;r<t.length;++r){for(var i=this.getCoordBoundingBox(t[r]),a=p.lc2(i.min,.5,i.max,.5),s=0;a.x>e[s];)++s;o[s]=o[s]||{},f.mergeIn(o[s],t[r])}var u=[],c=[],l=[];for(r=0;r<o.length;++r)o[r]?(i=this.getCoordBoundingBox(o[r]),a=p.lc2(i.min,.5,i.max,.5),a.x<n?c.push(o[r]):l.push(o[r])):u.push("");return{reactants:c,products:l}},a.prototype.clone=function(){return new a(this)},s.prototype.clone=function(){return new s(this)},e.exports=Object.assign(r,{Atom:h,AtomList:m,Bond:g,SGroup:v,RGroup:b,RxnPlus:a,RxnArrow:s})},{"../../util/map":653,"../../util/pool":654,"../../util/set":656,"../../util/vec2":657,"../element":516,"./atom":530,"./atomlist":531,"./bond":532,"./rgroup":534,"./sgforest":535,"./sgroup":536}],534:[function(t,e,n){"use strict";function r(t){t=t||{},this.frags=new o,this.resth=t.resth||!1,this.range=t.range||"",this.ifthen=t.ifthen||0}var o=t("../../util/pool");r.prototype.getAttrs=function(){return{resth:this.resth,range:this.range,ifthen:this.ifthen}},r.findRGroupByFragment=function(t,e){var n;return t.each(function(t,r){r.frags.keyOf(e)&&(n=t)}),n},r.prototype.clone=function(t){var e=new r(this);return this.frags.each(function(n,r){e.frags.add(t?t[r]:r)}),e},e.exports=r},{"../../util/pool":654}],535:[function(t,e,n){"use strict";function r(t){this.parent=new o,this.children=new o,this.children.set(-1,[]),this.molecule=t}var o=t("../../util/map"),i=t("../../util/set");r.prototype.getSGroupsBFS=function(){for(var t=[],e=-1,n=[].slice.call(this.children.get(-1));n.length>0;)e=n.shift(),n=n.concat(this.children.get(e)),t.push(e);return t},r.prototype.getAtomSets=function(){return this.molecule.sgroups.map(function(t,e){return i.fromList(e.atoms)})},r.prototype.getAtomSetRelations=function(t,e){var n=new o,r=new o,a=this.getAtomSets();a.unset(t),a.each(function(t,o){r.set(t,i.subset(e,o)),n.set(t,i.subset(o,e)&&!i.eq(o,e))},this);var s=a.findAll(function(t){return!!r.get(t)&&!(this.children.get(t).findIndex(function(t){return r.get(t)},this)>=0)},this);return console.assert(s.length<=1,"We are here"),{children:a.findAll(function(t){return n.get(t)&&!n.get(this.parent.get(t))},this),parent:0===s.length?-1:s[0]}},r.prototype.getPathToRoot=function(t){for(var e=[],n=t;n>=0;n=this.parent.get(n))console.assert(e.indexOf(n)<0,"SGroupForest: loop detected"),e.push(n);return e},r.prototype.validate=function(){var t=this.getAtomSets();this.molecule.sgroups.each(function(t){this.getPathToRoot(t)},this);var e=!0;return this.parent.each(function(n,r){r>=0&&!i.subset(t.get(n),t.get(r))&&(e=!1)},this),this.children.each(function(n){for(var r=this.children.get(n),o=0;o<r.length;++o)for(var a=o+1;a<r.length;++a){var s=r[o],u=r[a],c=this.molecule.sgroups.get(s),l=this.molecule.sgroups.get(u);i.disjoint(t.get(s),t.get(u))||"DAT"==c.type||"DAT"==l.type||(e=!1)}},this),e},r.prototype.insert=function(t,e,n){console.assert(!this.parent.has(t),"sgid already present in the forest"),console.assert(!this.children.has(t),"sgid already present in the forest"),console.assert(this.validate(),"s-group forest invalid");var r=this.getAtomSets(),o=i.fromList(this.molecule.sgroups.get(t).atoms);if(!e||!n){var a=this.getAtomSetRelations(t,o,r);e=a.parent,n=a.children}return n.forEach(function(e){var n=this.children.get(this.parent.get(e)),r=n.indexOf(e);console.assert(r>=0&&n.indexOf(e,r+1)<0,"Assertion failed"),n.splice(r,1),this.parent.set(e,t)},this),this.children.set(t,n),this.parent.set(t,e),this.children.get(e).push(t),console.assert(this.validate(),"s-group forest invalid"),{parent:e,children:n}},r.prototype.remove=function(t){console.assert(this.parent.has(t),"sgid is not in the forest"),console.assert(this.children.has(t),"sgid is not in the forest"),console.assert(this.validate(),"s-group forest invalid");var e=this.parent.get(t);this.children.get(t).forEach(function(t){this.parent.set(t,e),this.children.get(e).push(t)},this);var n=this.children.get(e),r=n.indexOf(t);console.assert(r>=0&&n.indexOf(t,r+1)<0,"Assertion failed"),n.splice(r,1),this.children.unset(t),this.parent.unset(t),console.assert(this.validate(),"s-group forest invalid")},e.exports=r},{"../../util/map":653,"../../util/set":656}],536:[function(t,e,n){"use strict";function r(t){console.assert(t&&t in r.TYPES,"Invalid or unsupported s-group type"),this.type=t,this.id=-1,this.label=-1,this.bracketBox=null,this.bracketDir=new a(1,0),this.areas=[],this.highlight=!1,this.highlighting=null,this.selected=!1,this.selectionPlate=null,this.atoms=[],this.patoms=[],this.bonds=[],this.xBonds=[],this.neiAtoms=[],this.pp=null,this.data={mul:1,connectivity:"ht",name:"",subscript:"n",attached:!1,absolute:!0,showUnits:!1,nCharsToDisplay:-1,tagChar:"",daspPos:1,fieldType:"F",fieldName:"",fieldValue:"",units:"",query:"",queryOp:""}}var o=t("../../util/box2abs"),i=t("../../util/set"),a=t("../../util/vec2"),s=t("./atom"),u=t("./bond");r.TYPES={MUL:1,SRU:2,SUP:3,DAT:4,GEN:5},r.prototype.getAttr=function(t){return this.data[t]},r.prototype.getAttrs=function(){var t={};for(var e in this.data)this.data.hasOwnProperty(e)&&(t[e]=this.data[e]);return t},r.prototype.setAttr=function(t,e){var n=this.data[t];return this.data[t]=e,n},r.prototype.checkAttr=function(t,e){return this.data[t]==e},r.filterAtoms=function(t,e){for(var n=[],r=0;r<t.length;++r){var o=t[r];"number"!=typeof e[o]?n.push(o):e[o]>=0?n.push(e[o]):n.push(-1)}return n},r.removeNegative=function(t){for(var e=[],n=0;n<t.length;++n)t[n]>=0&&e.push(t[n]);return e},r.filter=function(t,e,n){e.atoms=r.removeNegative(r.filterAtoms(e.atoms,n))},r.clone=function(t,e){var n=new r(t.type);for(var o in t.data)n.data[o]=t.data[o];return n.atoms=t.atoms.map(function(t){return e[t]}),n.pp=t.pp,n.bracketBox=t.bracketBox,n.patoms=null,n.bonds=null,n.allAtoms=t.allAtoms,n},r.addAtom=function(t,e){t.atoms.push(e)},r.removeAtom=function(t,e){for(var n=0;n<t.atoms.length;++n)if(t.atoms[n]===e)return void t.atoms.splice(n,1);console.error("The atom is not found in the given s-group")},r.getCrossBonds=function(t,e,n,r){n.bonds.each(function(n,o){i.contains(r,o.begin)&&i.contains(r,o.end)?null!=t&&t.push(n):(i.contains(r,o.begin)||i.contains(r,o.end))&&null!=e&&e.push(n)},this)},r.bracketPos=function(t,e,n){var r=t.atoms;if(n&&2===n.length){var i=e.bonds.get(n[0]).getCenter(e),s=e.bonds.get(n[1]).getCenter(e);t.bracketDir=a.diff(s,i).normalized()}else t.bracketDir=new a(1,0);var u=t.bracketDir,c=null,l=[];r.forEach(function(t){var n=e.atoms.get(t),r=new a(n.pp),i=new a(.05*3,.05*3),s=new o(r,r).extend(i,i);l.push(s)},this),l.forEach(function(t){var e=null;[t.p0.x,t.p1.x].forEach(function(n){[t.p0.y,t.p1.y].forEach(function(t){var r=new a(n,t),i=new a(a.dot(r,u),a.dot(r,u.rotateSC(1,0)));e=null===e?new o(i,i):e.include(i)},this)},this),c=null===c?e:o.union(c,e)},this);var f=new a(.2,.4);null!==c&&(c=c.extend(f,f)),t.bracketBox=c},r.getBracketParameters=function(t,e,n,r,o,s){function u(t,e,n,r){this.c=t,this.d=e,this.n=e.rotateSC(1,0),this.w=n,this.h=r}var c=[];return e.length<2?function(){o=o||new a(1,0),s=s||o.rotateSC(1,0);var t=Math.min(.25,.3*r.sz().x),e=a.lc2(o,r.p0.x,s,.5*(r.p0.y+r.p1.y)),n=a.lc2(o,r.p1.x,s,.5*(r.p0.y+r.p1.y)),i=r.sz().y;c.push(new u(e,o.negated(),t,i),new u(n,o,t,i))}():2===e.length?function(){var n=t.bonds.get(e[0]),r=t.bonds.get(e[1]),o=n.getCenter(t),i=r.getCenter(t),s=a.diff(i,o).normalized(),l=s.negated();c.push(new u(o.addScaled(l,0),l,.25,1.5),new u(i.addScaled(s,0),s,.25,1.5))}():function(){for(var r=0;r<e.length;++r){var o=t.bonds.get(e[r]),a=o.getCenter(t),s=i.contains(n,o.begin)?o.getDir(t):o.getDir(t).negated();c.push(new u(a,s,.2,1))}}(),c},r.getObjBBox=function(t,e){console.assert(0!=t.length,"Atom list is empty");for(var n=e.atoms.get(t[0]).pp,r=new o(n,n),i=1;i<t.length;++i){var a=t[i],s=e.atoms.get(a),u=s.pp;r=r.include(u)}return r},r.getAtoms=function(t,e){if(!e.allAtoms)return e.atoms;var n=[];return t.atoms.each(function(t){n.push(t)}),n},r.getBonds=function(t,e){var n=r.getAtoms(t,e),o=[];return t.bonds.each(function(t,e){n.indexOf(e.begin)>=0&&n.indexOf(e.end)>=0&&o.push(t)}),o},r.prepareMulForSaving=function(t,e){t.atoms.sort(function(t,e){return t-e}),t.atomSet=i.fromList(t.atoms),t.parentAtomSet=i.clone(t.atomSet);var n=[],r=[];if(e.bonds.each(function(e,o){i.contains(t.parentAtomSet,o.begin)&&i.contains(t.parentAtomSet,o.end)?n.push(e):(i.contains(t.parentAtomSet,o.begin)||i.contains(t.parentAtomSet,o.end))&&r.push(e)},t),0!==r.length&&2!==r.length)throw{id:t.id,"error-type":"cross-bond-number",message:"Unsupported cross-bonds number"};var o=-1,a=-1,c=null;if(2===r.length){var l=e.bonds.get(r[0]);o=i.contains(t.parentAtomSet,l.begin)?l.begin:l.end;var f=e.bonds.get(r[1]);a=i.contains(t.parentAtomSet,f.begin)?f.begin:f.end,c=f}for(var p=null,d=a,h=[],m=0;m<t.data.mul-1;m++)if(p={},t.atoms.forEach(function(n){var r=e.atoms.get(n),o=e.atoms.add(new s(r));h.push(o),t.atomSet[o]=1,p[n]=o}),n.forEach(function(t){var n=e.bonds.get(t),r=new u(n);r.begin=p[r.begin],r.end=p[r.end],e.bonds.add(r)}),null!==c){var g=new u(c);g.begin=d,g.end=p[o],e.bonds.add(g),d=p[a]}if(d>=0){var v=e.bonds.get(r[1]);v.begin===a?v.begin=d:v.end=d}t.bonds=r,h.forEach(function(n){e.sGroupForest.getPathToRoot(t.id).reverse().forEach(function(t){e.atomAddToSGroup(t,n)})})},r.getMassCentre=function(t,e){for(var n=new a,r=0;r<e.length;++r)n=n.addScaled(t.atoms.get(e[r]).pp,1/e.length);return n},e.exports=r},{"../../util/box2abs":651,"../../util/set":656,"../../util/vec2":657,"./atom":530,"./bond":532}],537:[function(t,e,n){"use strict";function r(){this.operations=[]}function o(t,e,n){var r=et(e,n);return r.length>0&&(r.forEach(function(e){t.addOp(new pt.SGroupAtomRemove(e,n))}),!0)}function i(t,e,n){var r=e.molecule,o={};n.forEach(function(t){et(e,t).forEach(function(t){o[t]=o[t]?o[t]+1:1})});for(var i in o){var a=parseInt(i),s=e.sgroups.get(a).item;if(ht.SGroup.getAtoms(e.molecule,s).length===o[a]){var u=r.sgroups.get(a);t.mergeWith(L(a,u.getAttrs())),t.addOp(new pt.SGroupRemoveFromHierarchy(a)),t.addOp(new pt.SGroupDelete(a))}}}function a(t,e,n){var o=new r,i=t.molecule.sgroups.values().filter(function(t){return!t.data.attached&&!t.data.absolute});return 0===i.length?o:i.reduce(function(t,r){return 0===bt(r.atoms,e).length&&t.addOp(new pt.SGroupDataMove(r.id,n)),t},o)}function s(t,e,n){n=new ft(n);var o=new r,i=t.molecule,s=lt.empty(),u=lt.empty();if(e.atoms){var c=lt.fromList(e.atoms),l=[];t.bonds.each(function(t,e){return lt.contains(c,e.b.begin)&&lt.contains(c,e.b.end)?(l.push(t),void["hb1","hb2"].forEach(function(t){var n=i.halfBonds.get(e.b[t]).loop;n>=0&&lt.add(s,n)})):lt.contains(c,e.b.begin)?void lt.add(u,e.b.begin):void(lt.contains(c,e.b.end)&&lt.add(u,e.b.end))},this),l.forEach(function(t){return o.addOp(new pt.BondMove(t,n))}),lt.each(s,function(e){t.reloops.get(e)&&t.reloops.get(e).visel&&o.addOp(new pt.LoopMove(e,n))},this),e.atoms.forEach(function(t){return o.addOp(new pt.AtomMove(t,n,!lt.contains(u,t)))}),0===e.sgroupData.length&&o.mergeWith(a(t,e.atoms,n))}return e.rxnArrows&&e.rxnArrows.forEach(function(t){return o.addOp(new pt.RxnArrowMove(t,n,!0))}),e.rxnPluses&&e.rxnPluses.forEach(function(t){return o.addOp(new pt.RxnPlusMove(t,n,!0))}),e.sgroupData&&e.sgroupData.forEach(function(t){return o.addOp(new pt.SGroupDataMove(t,n))}),e.chiralFlags&&e.chiralFlags.forEach(function(){return o.addOp(new pt.ChiralFlagMove(n))}),o.perform(t)}function u(t,e,n,o){var i=new r;return("number"==typeof e?[e]:e).forEach(function(t){for(var e in ht.Atom.attrlist){var r;if(e in n)r=n[e];else{if(!o)continue;r=ht.Atom.attrGetDefault(e)}i.addOp(new pt.AtomAttr(t,e,r))}!o&&"label"in n&&null!=n.label&&"L#"!==n.label&&!n.atomList&&i.addOp(new pt.AtomAttr(t,"atomList",null))},this),i.perform(t)}function c(t,e,n,o,i){var a=new r;for(var s in ht.Bond.attrlist){var u;if(s in n)u=n[s];else{if(!i)continue;u=ht.Bond.attrGetDefault(s)}a.addOp(new pt.BondAttr(e,s,u))}return o&&a.mergeWith(E(t.molecule,e)),a.perform(t)}function l(t,e,n){n=Object.assign({},n);var o=new r;return n.fragment=o.addOp((new pt.FragmentAdd).perform(t)).frid,o.addOp(new pt.AtomAdd(n,e).perform(t)),o}function f(t,e,n,r){var o=e.molecule;if(r!=n&&"number"==typeof r){void 0!==ht.RGroup.findRGroupByFragment(o.rgroups,r)&&t.mergeWith(z(e,null,r)),o.atoms.each(function(o,i){i.fragment==r&&t.addOp(new pt.AtomAttr(o,"fragment",n).perform(e))}),t.addOp(new pt.FragmentDelete(r).perform(e))}}function p(t,e){var n=[],r=nt(t,e);tt(t,e).forEach(function(e){var o=nt(t,e.aid);ft.dist(r,o)<.1||n.push({id:e.aid,v:ft.diff(o,r)})}),n.sort(function(t,e){return Math.atan2(t.v.y,t.v.x)-Math.atan2(e.v.y,e.v.x)});var o,i,a=0,s=0;for(o=0;o<n.length;o++)i=ft.angle(n[o].v,n[(o+1)%n.length].v),i<0&&(i+=2*Math.PI),i>s&&(a=o,s=i);var u=new ft(1,0);if(n.length>0){if(1==n.length){s=-4*Math.PI/3;var c=tt(t,e)[0];if(Q(t,c.aid)>1){var l=[],f=nt(t,c.aid),p=ft.diff(r,f),d=Math.atan2(p.y,p.x);tt(t,c.aid).forEach(function(e){var n=nt(t,e.aid);if(!(e.bid==c.bid||ft.dist(f,n)<.1)){var r=ft.diff(n,f),o=Math.atan2(r.y,r.x)-d;o<0&&(o+=2*Math.PI),l.push(o)}}),l.sort(function(t,e){return t-e}),l[0]<=1.01*Math.PI&&l[l.length-1]<=1.01*Math.PI&&(s*=-1)}}i=s/2+Math.atan2(n[a].v.y,n[a].v.x),u=u.rotate(i)}u.add_(r);var h=mt.atom(t,u,null,.1);return h=null==h?{label:"C"}:h.id,{atom:h,pos:u}}function d(t,e,n,o,i,a){if(void 0===o){var s=p(t,n);o=s.atom,i=s.pos}var u=new r,c=null;if("number"!=typeof n)"number"==typeof o&&(c=J(t,o,"fragment"));else if(c=J(t,n,"fragment"),"number"==typeof o){var l=J(t,o,"fragment");f(u,t,c,l)}null==c&&(c=u.addOp((new pt.FragmentAdd).perform(t)).frid),"number"!=typeof n?(n.fragment=c,n=u.addOp(new pt.AtomAdd(n,i).perform(t)).data.aid,i=a):"*"===J(t,n,"label")&&u.addOp(new pt.AtomAttr(n,"label","C").perform(t)),"number"!=typeof o?(o.fragment=c,o=u.addOp(new pt.AtomAdd(o,i).perform(t)).data.aid,"number"==typeof n&&et(t,n).forEach(function(e){u.addOp(new pt.SGroupAtomAdd(e,o).perform(t))},this)):"*"===J(t,o,"label")&&u.addOp(new pt.AtomAttr(o,"label","C").perform(t));var d=u.addOp(new pt.BondAdd(n,o,e).perform(t)).data.bid;return u.operations.reverse(),[u,n,o,d]}function h(t,e){var n=new r;return t.molecule.rxnArrows.count()<1&&n.addOp(new pt.RxnArrowAdd(e).perform(t)),n}function m(t,e){var n=new r;return n.addOp(new pt.RxnArrowDelete(e)),n.perform(t)}function g(t,e){var n=new r,o=t.molecule;if(t.chiralFlags.count()<1){if(!e){var i=o.getCoordBoundingBox(),a=o.isBlank()?i.min.y+1:i.min.y-1;e=new ft(i.max.x,a)}n.addOp(new pt.ChiralFlagAdd(e).perform(t))}return n}function v(t){var e=new r;return e.addOp(new pt.ChiralFlagDelete),e.perform(t)}function b(t,e){var n=new r;return n.addOp(new pt.RxnPlusAdd(e).perform(t)),n}function y(t,e){var n=new r;return n.addOp(new pt.RxnPlusDelete(e)),n.perform(t)}function _(t,e){var n=new r,a=[],s=t.molecule.atoms.get(e).fragment;return tt(t,e).forEach(function(e){n.addOp(new pt.BondDelete(e.bid)),1==Q(t,e.aid)&&(o(n,t,e.aid)&&a.push(e.aid),n.addOp(new pt.AtomDelete(e.aid)))},this),o(n,t,e)&&a.push(e),n.addOp(new pt.AtomDelete(e)),i(n,t,a),n=n.perform(t),n.mergeWith(new w(t,s)),n}function x(t,e){var n=new r,a=t.molecule.bonds.get(e),s=t.molecule.atoms.get(a.begin).fragment,u=[];return n.addOp(new pt.BondDelete(e)),1==Q(t,a.begin)&&(o(n,t,a.begin)&&u.push(a.begin),n.addOp(new pt.AtomDelete(a.begin))),1==Q(t,a.end)&&(o(n,t,a.end)&&u.push(a.end),n.addOp(new pt.AtomDelete(a.end))),i(n,t,u),n=n.perform(t),n.mergeWith(new w(t,s)),n}function w(t,e){var n=new r,o=ht.RGroup.findRGroupByFragment(t.molecule.rgroups,e);return t.molecule.atoms.each(function(r,i){if(i.fragment===e){var a=n.addOp((new pt.FragmentAdd).perform(t)).frid;!function r(o){n.addOp(new pt.AtomAttr(o,"fragment",a).perform(t)),tt(t,o).forEach(function(n){t.molecule.atoms.get(n.aid).fragment===e&&r(n.aid)})}(r),o&&n.mergeWith(z(t,o,a))}}),-1!==e&&(n.mergeWith(z(t,0,e)),n.addOp(new pt.FragmentDelete(e).perform(t)),n.mergeWith(U(t,0,o))),n}function S(t,e){console.assert(!!e);var n=new r,a=[],s=[];e={atoms:e.atoms||[],bonds:e.bonds||[],rxnPluses:e.rxnPluses||[],rxnArrows:e.rxnArrows||[],sgroupData:e.sgroupData||[],chiralFlags:e.chiralFlags||[]};var u=new r;for(e.sgroupData.forEach(function(e){u.mergeWith(D(t,e))},this),e.atoms.forEach(function(n){tt(t,n).forEach(function(t){-1==e.bonds.indexOf(t.bid)&&(e.bonds=e.bonds.concat([t.bid]))},this)},this),e.bonds.forEach(function(r){n.addOp(new pt.BondDelete(r));var i=t.molecule.bonds.get(r),u=t.molecule.atoms.get(i.begin).fragment;s.indexOf(u)<0&&s.push(u),-1==e.atoms.indexOf(i.begin)&&1==Q(t,i.begin)&&(o(n,t,i.begin)&&a.push(i.begin),n.addOp(new pt.AtomDelete(i.begin))),-1==e.atoms.indexOf(i.end)&&1==Q(t,i.end)&&(o(n,t,i.end)&&a.push(i.end),n.addOp(new pt.AtomDelete(i.end)))},this),e.atoms.forEach(function(e){var r=t.molecule.atoms.get(e).fragment;s.indexOf(r)<0&&s.push(r),o(n,t,e)&&a.push(e),n.addOp(new pt.AtomDelete(e))},this),i(n,t,a),e.rxnArrows.forEach(function(t){n.addOp(new pt.RxnArrowDelete(t))},this),e.rxnPluses.forEach(function(t){n.addOp(new pt.RxnPlusDelete(t))},this),e.chiralFlags.forEach(function(t){n.addOp(new pt.ChiralFlagDelete(t))},this),n=n.perform(t);s.length>0;)n.mergeWith(new w(t,s.pop()));return n.mergeWith(u),n}function O(t,e,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments[4];if(e===n)return new r;var u=new r,c=J(t,e,"fragment"),l=J(t,n,"fragment");c!==l&&f(u,t,c,l);var p=new r;tt(t,e).forEach(function(e){var r,o,i=t.molecule.bonds.get(e.bid);i.begin===e.aid?(r=e.aid,o=n):(r=n,o=e.aid),n!==i.begin&&n!==i.end&&-1===t.molecule.findBondId(r,o)&&p.addOp(new pt.BondAdd(r,o,i)),a.includes(""+e.bid)||p.addOp(new pt.BondDelete(e.bid))},this);var d=ht.Atom.getAttrHash(t.molecule.atoms.get(e));1===Q(t,e)&&"*"===d.label&&(d.label="C");for(var h in d)d.hasOwnProperty(h)&&p.addOp(new pt.AtomAttr(n,h,d[h]));var m=o(p,t,e);return s||p.addOp(new pt.AtomDelete(e)),m&&i(p,t,[e]),p.perform(t).mergeWith(u)}function A(t,e){var n=new r,o=[],i=Object.keys(e);Object.entries(e).forEach(function(e){var a=ct(e,2),s=a[0],u=a[1],c=t.molecule.bonds.get(+s),l=t.molecule.bonds.get(+u),f=new r,p=dt.mergeBondsParams(t,c,l);if(p){var d=ht.Bond.getAttrHash(c);for(var h in d)d.hasOwnProperty(h)&&f.addOp(new pt.BondAttr(u,h,d[h]));f.addOp(new pt.BondDelete(+s)),f=f.perform(t),o.includes(c.begin)||o.push(c.begin),o.includes(c.end)||o.push(c.end),n=O(t,c.begin,p.cross?l.end:l.begin,i,!0).mergeWith(O(t,c.end,p.cross?l.begin:l.end,i,!0)).mergeWith(f).mergeWith(n)}});var a=new r;return o.forEach(function(t){return a.addOp(new pt.AtomDelete(t))}),a=a.perform(t),a.mergeWith(n)}function E(t,e){var n=t.bonds.get(e),o=new r;return o.addOp(new pt.BondDelete(e)),
o.addOp(new pt.BondAdd(n.end,n.begin,n)).data.bid=e,o}function j(t,e){return E(t.molecule,e).perform(t)}function P(t,e,n,o){var i=new r,a=o.molecule,s=(new pt.FragmentAdd).perform(t),u={};return a.atoms.each(function(r,a){var c,l=ht.Atom.getAttrHash(a);l.fragment=s.frid,i.addOp(c=new pt.AtomAdd(l,ft.diff(a.pp,o.xy0).rotate(n).add(e)).perform(t)),u[r]=c.data.aid}),a.bonds.each(function(e,n){i.addOp(new pt.BondAdd(u[n.begin],u[n.end],n).perform(t))}),i.operations.reverse(),i.addOp(s),i}function T(t,e,n){var o=new r;return e.forEach(function(e){o.addOp(new pt.SGroupAtomAdd(e,n).perform(t))},this),o}function C(t,e,n,o,i){var a=new r,s=i.molecule,c=t.molecule,l=c.atoms.get(e),f=e,h=null,m=et(t,e),g=J(t,e,"fragment"),v={},b=s.atoms.get(i.aid).pp;if(o){if(null==n){var y=p(t,e),_=d(t,{type:1},e,y.atom,y.pos.get_xy0());a=_[0],a.operations.reverse(),h=e=_[2]}else{var x;a.addOp(x=new pt.AtomAdd({label:"C",fragment:g},new ft(1,0).rotate(n).add(l.pp).get_xy0()).perform(t)),a.addOp(new pt.BondAdd(e,x.data.aid,{type:1}).perform(t)),h=e=x.data.aid,a.mergeWith(T(t,m,e))}var w=l;l=c.atoms.get(e);var S=dt.calcAngle(w.pp,l.pp)-i.angle0}else null==n&&(y=p(t,e),n=dt.calcAngle(l.pp,y.pos)),S=n-i.angle0;return s.atoms.each(function(n,r){var o=ht.Atom.getAttrHash(r);if(o.fragment=g,n==i.aid)a.mergeWith(u(t,e,o,!0)),v[n]=e;else{var s;s=ft.diff(r.pp,b).rotate(S).add(l.pp),a.addOp(x=new pt.AtomAdd(o,s.get_xy0()).perform(t)),v[n]=x.data.aid}v[n]-0!=f-0&&v[n]-0!=h-0&&a.mergeWith(T(t,m,v[n]))}),s.bonds.each(function(e,n){a.addOp(new pt.BondAdd(v[n.begin],v[n.end],n).perform(t))}),a.operations.reverse(),a}function R(t,e,n,o){var i,a,s=new r,l=n.molecule,f=t.molecule,p=f.bonds.get(e),d=f.atoms.get(p.begin),h=f.atoms.get(p.end),m=lt.list(lt.intersection(lt.fromList(et(t,p.begin)),lt.fromList(et(t,p.end)))),g=l.bonds.get(n.bid),v=J(t,p.begin,"fragment"),b={};o?(i=l.atoms.get(g.end),a=l.atoms.get(g.begin),b[g.end]=p.begin,b[g.begin]=p.end):(i=l.atoms.get(g.begin),a=l.atoms.get(g.end),b[g.begin]=p.begin,b[g.end]=p.end);var y=dt.calcAngle(d.pp,h.pp)-dt.calcAngle(i.pp,a.pp),_=ft.dist(d.pp,h.pp)/ft.dist(i.pp,a.pp);return l.atoms.each(function(e,n){var r=ht.Atom.getAttrHash(n);if(r.fragment=v,e==g.begin||e==g.end)return void s.mergeWith(u(t,b[e],r,!0));var o;o=ft.diff(n.pp,i.pp).rotate(y).scaled(_).add(d.pp);var a=mt.atom(t,o,null,.1);if(null==a){var c;s.addOp(c=new pt.AtomAdd(r,o).perform(t)),b[e]=c.data.aid,s.mergeWith(T(t,m,b[e]))}else b[e]=a.id,s.mergeWith(u(t,b[e],r,!0))}),l.bonds.each(function(e,n){var r=f.findBondId(b[n.begin],b[n.end]);-1==r?s.addOp(new pt.BondAdd(b[n.begin],b[n.end],n).perform(t)):s.mergeWith(c(t,r,g,!1,!0))}),s.operations.reverse(),s}function N(t,e,n,o,i){var a,s=Math.cos(Math.PI/6),u=Math.sin(Math.PI/6),c=new r;a=null!=i?J(t,i,"fragment"):c.addOp((new pt.FragmentAdd).perform(t)).frid;var l=-1;l=null!=i?i:c.addOp(new pt.AtomAdd({label:"C",fragment:a},e).perform(t)).data.aid,c.operations.reverse();for(var f=0;f<o;f++){var p=new ft(s*(f+1),1&f?0:u).rotate(n).add(e),h=mt.atom(t,p,null,.1),m=d(t,{},l,h?h.id:{},p);c=m[0].mergeWith(c),l=m[2]}return c}function k(t,e){var n=new r;return n.addOp(new pt.CanvasLoad(e)),n.perform(t)}function I(t,e,n){var o=t.sgroups.get(e).item,i=o.type;if(n&&n!=i){var a=[].slice.call(ht.SGroup.getAtoms(t.molecule,o)),s=o.getAttrs(),u=D(t,e);return F(t,n,a,s,e).mergeWith(u)}return new r}function B(t,e,n,o){var i=o.fieldValue;return"string"==typeof i||"DAT"!==e?r.fromSgroupAddition(t,e,n,o,t.molecule.sgroups.newId()):i.reduce(function(i,a){var s=Object.assign({},o);return s.fieldValue=a,i.mergeWith(r.fromSgroupAddition(t,e,n,s,t.molecule.sgroups.newId()))},new r)}function M(t,e,n){var o=new r;return Object.keys(n).forEach(function(t){return o.addOp(new pt.SGroupAttr(e,t,n[t]))}),o.perform(t)}function L(t,e){var n=new r;return Object.keys(e).forEach(function(r){return n.addOp(new pt.SGroupAttr(t,r,e[r]))}),n}function D(t,e){var n=new r,o=t.molecule,i=t.sgroups.get(e).item;if("SRU"===i.type){o.sGroupsRecalcCrossBonds();i.neiAtoms.forEach(function(e){"*"===J(t,e,"label")&&n.addOp(new pt.AtomAttr(e,"label","C"))},this)}var a=o.sgroups.get(e),s=ht.SGroup.getAtoms(o,a),u=a.getAttrs();n.addOp(new pt.SGroupRemoveFromHierarchy(e));for(var c=0;c<s.length;++c)n.addOp(new pt.SGroupAtomRemove(e,s[c]));return n.addOp(new pt.SGroupDelete(e)),n=n.perform(t),n.mergeWith(L(e,u)),n}function F(t,e,n,o,i,a){var s,u=new r;for(i=i-0===i?i:t.molecule.sgroups.newId(),u.addOp(new pt.SGroupCreate(i,e,a)),s=0;s<n.length;s++)u.addOp(new pt.SGroupAtomAdd(i,n[s]));if(u.addOp("DAT"!=e?new pt.SGroupAddToHierarchy(i):new pt.SGroupAddToHierarchy(i,-1,[])),u=u.perform(t),"SRU"===e){t.molecule.sGroupsRecalcCrossBonds();var c=new r;t.sgroups.get(i).item.neiAtoms.forEach(function(e){var n=t.atoms.get(e).a.isPlainCarbon();1==Q(t,e)&&n&&c.addOp(new pt.AtomAttr(e,"label","*"))},this),c=c.perform(t),c.mergeWith(u),u=c}return M(t,i,o).mergeWith(u)}function G(t,e,n){var o=new r;for(var i in n)n.hasOwnProperty(i)&&o.addOp(new pt.RGroupAttr(e,i,n[i]));return o.perform(t)}function z(t,e,n){var o=new r;return o.addOp(new pt.RGroupFragment(e,n)),o.perform(t)}function U(t,e,n){var o=new r;return t.molecule.rgroups.get(n)||o.addOp(new pt.UpdateIfThen(e,n)),o.perform(t)}function W(t){if(t.atoms.length){for(var e=1e50,n=e,r=-e,o=-n,i=0;i<t.atoms.length;i++)e=Math.min(e,t.atoms[i].pp.x),n=Math.min(n,t.atoms[i].pp.y),r=Math.max(r,t.atoms[i].pp.x),o=Math.max(o,t.atoms[i].pp.y);return new ft((e+r)/2,(n+o)/2)}return t.rxnArrows.length?t.rxnArrows[0].pp:t.rxnPluses.length?t.rxnPluses[0].pp:t.chiralFlags.length?t.chiralFlags[0].pp:null}function H(t){console.assert(!t.isBlank(),"Empty struct");var e=$(t),n={atoms:[],bonds:[],sgroups:[],rxnArrows:[],rxnPluses:[],chiralFlags:[],rgmap:{},rgroups:{}},r={};e.atoms.forEach(function(e){var o=new ht.Atom(t.atoms.get(e));o.pos=o.pp,r[e]=n.atoms.push(new ht.Atom(o))-1}),e.bonds.forEach(function(e){var o=new ht.Bond(t.bonds.get(e));o.begin=r[o.begin],o.end=r[o.end],n.bonds.push(new ht.Bond(o))}),t.getSGroupsInAtomSet(e.atoms).forEach(function(e){for(var o=t.sgroups.get(e),i=ht.SGroup.getAtoms(t,o),a={type:o.type,attrs:o.getAttrs(),atoms:[].slice.call(i),pp:o.pp},s=0;s<a.atoms.length;s++)a.atoms[s]=r[a.atoms[s]];n.sgroups.push(a)},this),e.rxnArrows.forEach(function(e){var r=new ht.RxnArrow(t.rxnArrows.get(e));r.pos=r.pp,n.rxnArrows.push(r)}),e.rxnPluses.forEach(function(e){var r=new ht.RxnPlus(t.rxnPluses.get(e));r.pos=r.pp,n.rxnPluses.push(r)});var o={},i=lt.empty();e.atoms.forEach(function(e){var n=t.atoms.get(e),r=n.fragment;o[e]=r,lt.add(i,r)});var a=lt.empty();return lt.each(i,function(e){for(var r=Z(t,e),i=0;i<r.length;++i)if(!lt.contains(o,r[i]))return;var s=ht.RGroup.findRGroupByFragment(t.rgroups,e);n.rgmap[e]=s,lt.add(a,s)},this),lt.each(a,function(e){n.rgroups[e]=t.rgroups.get(e).getAttrs()},this),n}function V(t,e,n){for(var o=H(e),i=n?ft.diff(n,W(o)):new ft,a=new r,s={},u={},c=0;c<o.atoms.length;c++){var l=Object.assign({},o.atoms[c]);l.fragment in u||(u[l.fragment]=a.addOp((new pt.FragmentAdd).perform(t)).frid),l.fragment=u[l.fragment],s[c]=a.addOp(new pt.AtomAdd(l,l.pp.add(i)).perform(t)).data.aid}var f=[];for(var p in o.rgroups)o.rgroups.hasOwnProperty(p)&&!t.molecule.rgroups.has(p)&&f.push(p);for(var d in o.rgmap)o.rgmap.hasOwnProperty(d)&&a.addOp(new pt.RGroupFragment(o.rgmap[d],u[d]).perform(t));for(var h=0;h<f.length;++h)a.mergeWith(G(t,f[h],o.rgroups[f[h]]));for(var m=0;m<o.bonds.length;m++){var v=Object.assign({},o.bonds[m]);a.addOp(new pt.BondAdd(s[v.begin],s[v.end],v).perform(t))}for(var b=0;b<o.sgroups.length;b++){for(var y=o.sgroups[b],_=y.atoms,x=[],w=0;w<_.length;w++)x.push(s[_[w]]);for(var S=t.molecule.sgroups.newId(),O=F(t,y.type,x,y.attrs,S,y.pp?y.pp.add(i):null),A=O.operations.length-1;A>=0;A--)a.addOp(O.operations[A])}if(t.rxnArrows.count()<1)for(var E=0;E<o.rxnArrows.length;E++)a.addOp(new pt.RxnArrowAdd(o.rxnArrows[E].pp.add(i)).perform(t));for(var j=0;j<o.rxnPluses.length;j++)a.addOp(new pt.RxnPlusAdd(o.rxnPluses[j].pp.add(i)).perform(t));if(e.isChiral){var P=e.getCoordBoundingBox(),T=new ft(P.max.x,P.min.y-1);a.mergeWith(g(t,T.add(i)))}return a.operations.reverse(),a}function q(t,e,n){var o=t.molecule,i=new r;if(e||(e=$(o)),!e.atoms)return i.perform(t);var a=e.atoms.reduce(function(t,e){var n=o.atoms.get(e);return t[n.fragment]||(t[n.fragment]=[]),t[n.fragment].push(e),t},{});return Object.keys(a).find(function(t){return t=parseInt(t,10),!lt.eq(o.getFragmentIds(t),lt.fromList(a[t]))})?i:(Object.keys(a).forEach(function(t){var e=lt.fromList(a[t]),r=o.getCoordBoundingBox(e);lt.each(e,function(t){var e=o.atoms.get(t),a=new ft;"horizontal"===n?a.x=r.min.x+r.max.x-2*e.pp.x:a.y=r.min.y+r.max.y-2*e.pp.y,i.addOp(new pt.AtomMove(t,a))})}),e.bonds&&e.bonds.forEach(function(t){var e=o.bonds.get(t);if(e.type===ht.Bond.PATTERN.TYPE.SINGLE)return e.stereo===ht.Bond.PATTERN.STEREO.UP?void i.addOp(new pt.BondAttr(t,"stereo",ht.Bond.PATTERN.STEREO.DOWN)):void(e.stereo===ht.Bond.PATTERN.STEREO.DOWN&&i.addOp(new pt.BondAttr(t,"stereo",ht.Bond.PATTERN.STEREO.UP)))}),i.perform(t))}function K(t,e,n,o){var i=t.molecule,a=new r;return e||(e=$(i)),e.atoms&&e.atoms.forEach(function(t){var e=i.atoms.get(t);a.addOp(new pt.AtomMove(t,X(e.pp,n,o)))}),e.rxnArrows&&e.rxnArrows.forEach(function(t){var e=i.rxnArrows.get(t);a.addOp(new pt.RxnArrowMove(t,X(e.pp,n,o)))}),e.rxnPluses&&e.rxnPluses.forEach(function(t){var e=i.rxnPluses.get(t);a.addOp(new pt.RxnPlusMove(t,X(e.pp,n,o)))}),e.sgroupData&&e.sgroupData.forEach(function(t){var e=i.sgroups.get(t);a.addOp(new pt.SGroupDataMove(t,X(e.pp,n,o)))}),e.chiralFlags&&e.chiralFlags.forEach(function(e){var r=t.chiralFlags.get(e);a.addOp(new pt.ChiralFlagMove(X(r.pp,n,o)))}),a.perform(t)}function Y(t,e,n){var r=t.molecule,o=r.bonds.get(e),i=r.atoms.get(o.begin),a=r.atoms.get(o.end),s=i.pp.add(a.pp).scaled(.5),u=dt.calcAngle(i.pp,a.pp),c=Z(r,i.fragment);return u="horizontal"===n?-u:Math.PI/2-u,K(t,{atoms:c},s,u)}function $(t){return["atoms","bonds","frags","sgroups","rgroups","rxnArrows","rxnPluses"].reduce(function(e,n){return e[n]=t[n].keys(),e},{})}function Z(t,e){var n=[];return t.atoms.each(function(t,r){r.fragment==e&&n.push(t)}),n}function X(t,e,n){var r=t.sub(e);return r=r.rotate(n),r.add_(e),r.sub(t)}function J(t,e,n){return t.molecule.atoms.get(e)[n]}function Q(t,e){return t.atoms.get(e).a.neighbors.length}function tt(t,e){for(var n=t.atoms.get(e),r=[],o=0;o<n.a.neighbors.length;++o){var i=t.molecule.halfBonds.get(n.a.neighbors[o]);r.push({aid:i.end-0,bid:i.bid-0})}return r}function et(t,e){var n=t.atoms.get(e);return lt.list(n.a.sgs)}function nt(t,e){return t.molecule.atoms.get(e).pp}function rt(t,e,n){return n.reduce(function(n,r){return n.action=n.action.mergeWith(B(t,e.type,[r],e.attrs)),n},{action:new r,selection:{atoms:n,bonds:[]}})}function ot(t,e,n,o){return Object.keys(n.reduce(function(e,n){return e[t.atoms.get(n).a.fragment]=!0,e},{})).map(Number).reduce(function(n,r){var i=o.filter(function(e){var n=t.atoms.get(e).a;return r===n.fragment}).map(Number),a=ut(t.molecule,i);return n.action=n.action.mergeWith(B(t,e.type,i,e.attrs)),n.selection.atoms=n.selection.atoms.concat(i),n.selection.bonds=n.selection.bonds.concat(a),n},{action:new r,selection:{atoms:[],bonds:[]}})}function it(t,e,n,o){var i=t.molecule,a=ut(i,n);return o.bonds&&(a=vt(a.concat(o.bonds))),a.reduce(function(n,r){var o=i.bonds.get(r);return n.action=n.action.mergeWith(B(t,e.type,[o.begin,o.end],e.attrs)),n.selection.bonds.push(r),n},{action:new r,selection:{atoms:n,bonds:[]}})}function at(t,e,n){var r=ut(t.molecule,n);return{action:B(t,e.type,n,e.attrs),selection:{atoms:n,bonds:r}}}function st(t){var e=new r;return e.addOp(new pt.AlignDescriptors(t)),e.perform(t)}function ut(t,e){return t.bonds.keys().reduce(function(n,r){var o=t.bonds.get(r);return e.includes(o.begin)&&e.includes(o.end)&&n.push(parseInt(r)),n},[])}var ct=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),lt=t("../util/set"),ft=t("../util/vec2"),pt=t("./op"),dt=t("./tool/utils"),ht=t("../chem/struct"),mt=t("./closest"),gt=t("lodash"),vt=gt.uniq,bt=gt.difference;r.prototype.addOp=function(t,e){return e&&t.isDummy(e)||this.operations.push(t),t},r.prototype.mergeWith=function(t){return this.operations=this.operations.concat(t.operations),this},r.prototype.perform=function(t){var e=new r;return this.operations.forEach(function(n){e.addOp(n.perform(t))}),e.operations.reverse(),e},r.prototype.isDummy=function(t){return void 0===this.operations.find(function(e){return!t||!e.isDummy(t)})},e.exports=Object.assign(r,{fromMultipleMove:s,fromAtomAddition:l,fromArrowAddition:h,fromArrowDeletion:m,fromChiralFlagAddition:g,fromChiralFlagDeletion:v,fromPlusAddition:b,fromPlusDeletion:y,fromAtomDeletion:_,fromBondDeletion:x,fromFragmentDeletion:S,fromAtomMerge:O,fromBondsMerge:A,fromBondFlipping:j,fromTemplateOnCanvas:P,fromTemplateOnAtom:C,fromTemplateOnBond:R,fromAtomsAttrs:u,fromBondAttrs:c,fromChain:N,fromBondAddition:d,fromNewCanvas:k,fromSgroupType:I,fromSgroupDeletion:D,fromSgroupAttrs:M,fromRGroupFragment:z,fromPaste:V,fromRGroupAttrs:G,fromSgroupAddition:F,fromFlip:q,fromRotate:K,fromBondAlign:Y,fromAtomAction:rt,fromGroupAction:ot,fromBondAction:it,fromSeveralSgroupAddition:B,fromUpdateIfThen:U,fromMultiFragmentAction:at,fromDescriptorsAlign:st})},{"../chem/struct":533,"../util/set":656,"../util/vec2":657,"./closest":538,"./op":540,"./tool/utils":562,lodash:460}],538:[function(t,e,n){"use strict";function r(t,e,n,r){var o=null,i=m,a=n&&"atoms"===n.map?n.id:null;return r=r||i,r=Math.min(r,i),t.atoms.each(function(t,n){if(t!==a){var i=h.dist(e,n.a.pp);i<r&&(o=t,r=i)}}),null!==o?{id:o,dist:r}:null}function o(t,e,n,r,o){var i=null,a=null,s=m,u=n&&"bonds"===n.map?n.id:null;r=r||s,r=Math.min(r,s);var c=r;return t.bonds.each(function(n,r){if(n!==u){var o=t.atoms.get(r.b.begin).a.pp,i=t.atoms.get(r.b.end).a.pp,s=h.lc2(o,.5,i,.5),l=h.dist(e,s);l<c&&(c=l,a=n)}}),t.bonds.each(function(n,o){if(n!==u){var a=t.molecule.halfBonds.get(o.b.hb1),s=a.dir,c=a.norm,l=t.atoms.get(o.b.begin).a.pp,f=t.atoms.get(o.b.end).a.pp;if(h.dot(e.sub(l),s)*h.dot(e.sub(f),s)<0){var p=Math.abs(h.dot(e.sub(l),c));p<r&&(i=n,r=p)}}}),null!==a?{id:a,dist:c}:null!==i&&r>m*o?{id:i,dist:r}:null}function i(t,e){var n,r=null;return t.chiralFlags.each(function(t,o){var i=o.pp;if(Math.abs(e.x-i.x)<1){var a=Math.abs(e.y-i.y);a<.3&&(!r||a<n)&&(n=a,r={id:t,dist:n})}}),r}function a(t,e){var n=null,r=null;return t.sgroupData.each(function(t,o){if("DAT"!==o.sgroup.type)throw new Error("Data group expected");if("MRV_IMPLICIT_H"!==o.sgroup.data.fieldName){var i=o.sgroup.dataArea,a=i.p0.y<e.y&&i.p1.y>e.y&&i.p0.x<e.x&&i.p1.x>e.x,s=Math.min(Math.abs(i.p0.x-e.x),Math.abs(i.p1.x-e.x));a&&(null==r||s<n)&&(r={id:t,dist:s},n=s)}}),r}function s(t,e,n,r){r=Math.min(r||m,m);var o=null,i=n&&"frags"===n.map?n.id:null;return t.frags.each(function(n,a){if(n!=i){var s=a.calcBBox(t,n);if(s.p0.y<e.y&&s.p1.y>e.y&&s.p0.x<e.x&&s.p1.x>e.x){var u=Math.min(Math.abs(s.p0.x-e.x),Math.abs(s.p1.x-e.x));(!o||u<r)&&(r=u,o={id:n,dist:r})}}}),o}function u(t,e,n,r){r=Math.min(r||m,m);var o=null;return t.rgroups.each(function(t,i){if(t!=n&&i.labelBox&&i.labelBox.contains(e,.5)){var a=h.dist(i.labelBox.centre(),e);(!o||a<r)&&(r=a,o={id:t,dist:r})}}),o}function c(t,e){var n,r=null;return t.rxnArrows.each(function(t,o){var i=o.item.pp;if(Math.abs(e.x-i.x)<1){var a=Math.abs(e.y-i.y);a<.3&&(!r||a<n)&&(n=a,r={id:t,dist:n})}}),r}function l(t,e){var n,r=null;return t.rxnPluses.each(function(t,o){var i=o.item.pp,a=Math.max(Math.abs(e.x-i.x),Math.abs(e.y-i.y));a<.3&&(!r||a<n)&&(n=a,r={id:t,dist:n})}),r}function f(t,e){var n=null,r=m;return t.molecule.sgroups.each(function(t,o){for(var i=o.bracketDir,a=i.rotateSC(1,0),s=new h(h.dot(e,i),h.dot(e,a)),u=0;u<o.areas.length;++u){var c=o.areas[u],l=c.p0.y<s.y&&c.p1.y>s.y&&c.p0.x<s.x&&c.p1.x>s.x,f=Math.min(Math.abs(c.p0.x-s.x),Math.abs(c.p1.x-s.x));l&&(null==n||f<r)&&(n=t,r=f)}}),null!=n?{id:n,dist:r}:null}function p(t,e,n,r,o){return n=n||Object.keys(g),n.reduce(function(n,i){var a=n?n.dist:null,s=g[i](t,e,r,a,o);return null!==s&&(null===n||s.dist<n.dist)?{map:i,id:s.id,dist:s.dist}:n},null)}function d(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["atoms","bonds"],r=arguments[3],o={atoms:{},bonds:{}},i=t.molecule;e.atoms.forEach(function(t){return o.atoms[t]=i.atoms.get(t).pp}),e.bonds.forEach(function(t){var e=i.bonds.get(t);o.bonds[t]=h.lc2(o.atoms[e.begin],.5,o.atoms[e.end],.5)});var a={};return n.forEach(function(e){a[e]=Object.keys(o[e]).reduce(function(n,i){var a={map:e,id:+i},s=g[e](t,o[e][i],a,null,r);return s&&(n[i]=s.id),n},{})}),a}var h=t("../util/vec2"),m=.4,g={atoms:r,bonds:o,chiralFlags:i,sgroupData:a,sgroups:f,rxnArrows:c,rxnPluses:l,frags:s,rgroups:u};e.exports={atom:r,item:p,merge:d}},{"../util/vec2":657}],539:[function(t,e,n){(function(n){"use strict";function r(t,e){this.render=new p(t,Object.assign({scale:g},e)),this._selection=null,this._tool=null,this.historyStack=[],this.historyPtr=0,this.event={message:new u.Subscription,elementEdit:new u.PipelineSubscription,bondEdit:new u.PipelineSubscription,rgroupEdit:new u.PipelineSubscription,sgroupEdit:new u.PipelineSubscription,sdataEdit:new u.PipelineSubscription,quickEdit:new u.PipelineSubscription,attachEdit:new u.PipelineSubscription,change:new u.PipelineSubscription,selectionChange:new u.PipelineSubscription},o(this,t)}function o(t,e){["click","dblclick","mousedown","mousemove","mouseup","mouseleave"].forEach(function(n){var r=t.event[n]=new u.DOMSubscription;e.addEventListener(n,r.dispatch.bind(r)),r.add(function(e){return t.lastEvent=e,t.tool()&&n in t.tool()&&t.tool()[n](e),!0},-1)})}function i(t,e){console.assert(e,"Reference point not specified"),t.render.setScrollOffset(0,0)}function a(t,e){var n=t.getVBoxObj(e||{});return l.lc2(n.p0,.5,n.p1,.5)}function s(t){var e=0,n=0;do{e+=t.offsetTop||0,n+=t.offsetLeft||0,t=t.offsetParent}while(t);return new l(n,e)}var u=t("subscription"),c=t("../util/set"),l=t("../util/vec2"),f=t("../chem/struct"),p=t("../render"),d=t("./action"),h=t("./closest"),m={rgroupatom:t("./tool/rgroupatom"),select:t("./tool/select"),sgroup:t("./tool/sgroup"),eraser:t("./tool/eraser"),atom:t("./tool/atom"),bond:t("./tool/bond"),chain:t("./tool/chain"),chiralFlag:t("./tool/chiral-flag"),template:t("./tool/template"),charge:t("./tool/charge"),rgroupfragment:t("./tool/rgroupfragment"),apoint:t("./tool/apoint"),attach:t("./tool/attach"),reactionarrow:t("./tool/reactionarrow"),reactionplus:t("./tool/reactionplus"),reactionmap:t("./tool/reactionmap"),reactionunmap:t("./tool/reactionunmap"),paste:t("./tool/paste"),rotate:t("./tool/rotate")},g=40,v=["atoms","bonds","frags","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"];r.prototype.tool=function(t,e){if(arguments.length>0){this._tool&&this._tool.cancel&&this._tool.cancel();var n=m[t](this,e);if(!n)return null;this._tool=n}return this._tool},r.prototype.struct=function(t){return arguments.length>0&&(this.selection(null),this.update(d.fromNewCanvas(this.render.ctab,t||new f)),i(this,a(this.render.ctab))),this.render.ctab.molecule},r.prototype.options=function(t){if(arguments.length>0){var e=this.render.ctab.molecule,n=this.render.options.zoom;this.render.clientArea.innerHTML="",this.render=new p(this.render.clientArea,Object.assign({scale:g},t)),this.render.setMolecule(e),this.render.setZoom(n),this.render.update()}return this.render.options},r.prototype.zoom=function(t){return arguments.length>0&&(this.render.setZoom(t),i(this,a(this.render.ctab,this.selection())),this.render.update()),this.render.options.zoom},r.prototype.selection=function(t){var e=this.render.ctab;if(arguments.length>0){if(this._selection=null,"all"===t&&(t=v.reduce(function(t,n){return t[n]=e[n].ikeys(),t},{})),"descriptors"===t&&(e=this.render.ctab,t={sgroupData:e.sgroupData.ikeys()}),t){var n={};for(var r in t)t.hasOwnProperty(r)&&t[r].length>0&&(n[r]=t[r].slice());0!==Object.keys(n).length&&(this._selection=n)}this.render.ctab.setSelection(this._selection),this.event.selectionChange.dispatch(this._selection),this.render.update()}return this._selection},r.prototype.hover=function(t){var e=this._tool;"ci"in e&&(!t||e.ci.map!==t.map||e.ci.id!==t.id)&&(this.highlight(e.ci,!1),delete e.ci),t&&this.highlight(t,!0)&&(e.ci=t)},r.prototype.highlight=function(t,e){if(-1===["atoms","bonds","rxnArrows","rxnPluses","chiralFlags","frags","merge","rgroups","sgroups","sgroupData"].indexOf(t.map))return!1;var n=this.render,r=null;if("merge"===t.map)return Object.keys(t.items).forEach(function(o){t.items[o].forEach(function(t){r=n.ctab[o].get(t),r.setHighlight(e,n)})}),!0;if(!(r=n.ctab[t.map].get(t.id)))return!0;if("sgroups"===t.map&&"DAT"===r.item.type||"sgroupData"===t.map){var o=n.ctab.sgroups.get(t.id),i=n.ctab.sgroupData.get(t.id);o&&o.setHighlight(e,n),i&&i.setHighlight(e,n)}else r.setHighlight(e,n);return!0},r.prototype.update=function(t,e){!0===t?this.render.update(!0):(e||t.isDummy()||(this.historyStack.splice(this.historyPtr,33,t),this.historyStack.length>32&&this.historyStack.shift(),this.historyPtr=this.historyStack.length,this.event.change.dispatch(t)),this.render.update())},r.prototype.historySize=function(){return{undo:this.historyPtr,redo:this.historyStack.length-this.historyPtr}},r.prototype.undo=function(){if(0===this.historyPtr)throw new Error("Undo stack is empty");this.tool()&&this.tool().cancel&&this.tool().cancel(),this.selection(null),this.historyPtr--;var t=this.historyStack[this.historyPtr].perform(this.render.ctab);this.historyStack[this.historyPtr]=t,this.event.change.dispatch(t),this.render.update()},r.prototype.redo=function(){if(this.historyPtr===this.historyStack.length)throw new Error("Redo stack is empty");this.tool()&&this.tool().cancel&&this.tool().cancel(),this.selection(null);var t=this.historyStack[this.historyPtr].perform(this.render.ctab);this.historyStack[this.historyPtr]=t,this.historyPtr++,this.event.change.dispatch(t),this.render.update()},r.prototype.on=function(t,e){this.event[t].add(e)},r.prototype.findItem=function(t,e,r){var o=n._ui_editor?new l(this.render.page2obj(t)):new l(t.pageX,t.pageY).sub(s(this.render.clientArea));return h.item(this.render.ctab,o,e,r,this.render.options)},r.prototype.findMerge=function(t,e){return h.merge(this.render.ctab,t,e,this.render.options)},r.prototype.explicitSelected=function(){var t=this.selection()||{},e=v.reduce(function(e,n){return e[n]=t[n]?t[n].slice():[],e},{}),n=this.render.ctab.molecule;return"bonds"in e&&e.bonds.forEach(function(t){var r=n.bonds.get(t);e.atoms=e.atoms||[],e.atoms.indexOf(r.begin)<0&&e.atoms.push(r.begin),e.atoms.indexOf(r.end)<0&&e.atoms.push(r.end)}),"atoms"in e&&"bonds"in e&&n.bonds.each(function(t){if(!("bonds"in e)||e.bonds.indexOf(t)<0){var r=n.bonds.get(t);e.atoms.indexOf(r.begin)>=0&&e.atoms.indexOf(r.end)>=0&&(e.bonds=e.bonds||[],e.bonds.push(t))}}),e},r.prototype.structSelected=function(){var t=this.render.ctab.molecule,e=this.explicitSelected(),n=t.clone(c.fromList(e.atoms),c.fromList(e.bonds),!0);return t.rxnArrows.each(function(t,r){-1!=e.rxnArrows.indexOf(t)&&n.rxnArrows.add(r.clone())}),t.rxnPluses.each(function(t,r){-1!=e.rxnPluses.indexOf(t)&&n.rxnPluses.add(r.clone())}),n.isChiral=t.isChiral,n.isReaction=t.isReaction&&(n.rxnArrows.count()||n.rxnPluses.count()),n},r.prototype.alignDescriptors=function(){this.selection(null);var t=d.fromDescriptorsAlign(this.render.ctab);this.update(t),this.render.update(!0)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../chem/struct":533,"../render":565,"../util/set":656,"../util/vec2":657,"./action":537,"./closest":538,"./tool/apoint":541,"./tool/atom":542,"./tool/attach":543,"./tool/bond":544,"./tool/chain":545,"./tool/charge":546,"./tool/chiral-flag":547,"./tool/eraser":548,"./tool/paste":551,"./tool/reactionarrow":552,"./tool/reactionmap":553,"./tool/reactionplus":554,"./tool/reactionunmap":555,"./tool/rgroupatom":556,"./tool/rgroupfragment":557,"./tool/rotate":558,"./tool/select":559,"./tool/sgroup":560,"./tool/template":561,subscription:507}],540:[function(t,e,n){"use strict";function r(){this.type="OpBase",this.execute=function(){throw new Error("Operation.execute() is not implemented")},this.invert=function(){throw new Error("Operation.invert() is not implemented")},this.perform=function(t){return this.execute(t),this._inverted||(this._inverted=this.invert(),this._inverted._inverted=this),this._inverted},this.isDummy=function(t){return!!this._isDummy&&this._isDummy(t)}}function o(t,e){this.data={aid:null,atom:t,pos:e},this.execute=function(t){var e=t.molecule,n={};if(this.data.atom)for(var r in this.data.atom)this.data.atom.hasOwnProperty(r)&&(n[r]=this.data.atom[r]);n.label=n.label||"C","number"!=typeof this.data.aid?this.data.aid=e.atoms.add(new q.Atom(n)):e.atoms.set(this.data.aid,new q.Atom(n));var o=new K.Atom(t.molecule.atoms.get(this.data.aid));o.component=t.connectedComponents.add(H.single(this.data.aid)),t.atoms.set(this.data.aid,o),t.markAtom(this.data.aid,1),e.atomSetPos(this.data.aid,new W(this.data.pos))},this.invert=function(){var t=new i;return t.data=this.data,t}}function i(t){this.data={aid:t,atom:null,pos:null},this.execute=function(t){var e=t.molecule;this.data.atom||(this.data.atom=e.atoms.get(this.data.aid),this.data.pos=this.data.atom.pp);var n=t.atoms.get(this.data.aid),r=t.connectedComponents.get(n.component);H.remove(r,this.data.aid),0==H.size(r)&&t.connectedComponents.remove(n.component),t.clearVisel(n.visel),t.atoms.unset(this.data.aid),t.markItemRemoved(),e.atoms.remove(this.data.aid)},this.invert=function(){var t=new o;return t.data=this.data,t}}function a(t,e,n){this.data={aid:t,attribute:e,value:n},this.data2=null,this.execute=function(t){var e=t.molecule.atoms.get(this.data.aid);this.data2||(this.data2={aid:this.data.aid,attribute:this.data.attribute,value:e[this.data.attribute]}),e[this.data.attribute]=this.data.value,F(t,this.data.aid)},this._isDummy=function(t){return t.molecule.atoms.get(this.data.aid)[this.data.attribute]==this.data.value},this.invert=function(){var t=new a;return t.data=this.data2,t.data2=this.data,t}}function s(t,e,n){this.data={aid:t,d:e,noinvalidate:n},this.execute=function(t){var e=t.molecule,n=this.data.aid,r=this.data.d;e.atoms.get(n).pp.add_(r),t.atoms.get(n).visel.translate(V.obj2scaled(r,t.render.options)),this.data.d=r.negated(),this.data.noinvalidate||F(t,n,1)},this._isDummy=function(){return 0===this.data.d.x&&0===this.data.d.y},this.invert=function(){var t=new s;return t.data=this.data,t}}function u(t,e){this.data={bid:t,d:e},this.execute=function(t){t.bonds.get(this.data.bid).visel.translate(V.obj2scaled(this.data.d,t.render.options)),this.data.d=this.data.d.negated()},this.invert=function(){var t=new u;return t.data=this.data,t}}function c(t,e){this.data={id:t,d:e},this.execute=function(t){t.reloops.get(this.data.id)&&t.reloops.get(this.data.id).visel&&t.reloops.get(this.data.id).visel.translate(V.obj2scaled(this.data.d,t.render.options)),this.data.d=this.data.d.negated()},this.invert=function(){var t=new c;return t.data=this.data,t}}function l(t,e){this.type="OpSGroupAtomAdd",this.data={sgid:t,aid:e},this.execute=function(t){var e=t.molecule,n=this.data.aid,r=this.data.sgid,o=e.atoms.get(n);if(e.sgroups.get(r).atoms.indexOf(n)>=0)throw new Error("The same atom cannot be added to an S-group more than once");if(!o)throw new Error("OpSGroupAtomAdd: Atom "+n+" not found");e.atomAddToSGroup(r,n),F(t,n)},this.invert=function(){var t=new f;return t.data=this.data,t}}function f(t,e){this.type="OpSGroupAtomRemove",this.data={sgid:t,aid:e},this.execute=function(t){var e=this.data.aid,n=this.data.sgid,r=t.molecule,o=r.atoms.get(e),i=r.sgroups.get(n);q.SGroup.removeAtom(i,e),H.remove(o.sgs,n),F(t,e)},this.invert=function(){var t=new l;return t.data=this.data,t}}function p(t,e,n){this.type="OpSGroupAttr",this.data={sgid:t,attr:e,value:n},this.execute=function(t){var e=t.molecule,n=this.data.sgid,r=e.sgroups.get(n);"DAT"===r.type&&t.sgroupData.has(n)&&(t.clearVisel(t.sgroupData.get(n).visel),t.sgroupData.unset(n)),this.data.value=r.setAttr(this.data.attr,this.data.value)},this.invert=function(){var t=new p;return t.data=this.data,t}}function d(t,e,n){this.type="OpSGroupCreate",this.data={sgid:t,type:e,pp:n},this.execute=function(t){var e=t.molecule,n=new q.SGroup(this.data.type),r=this.data.sgid;n.id=r,e.sgroups.set(r,n),this.data.pp&&(e.sgroups.get(r).pp=new W(this.data.pp)),t.sgroups.set(r,new K.SGroup(e.sgroups.get(r))),this.data.sgid=r},this.invert=function(){var t=new h;return t.data=this.data,t}}function h(t){this.type="OpSGroupDelete",this.data={sgid:t},this.execute=function(t){var e=t.molecule,n=this.data.sgid,r=t.sgroups.get(n);if(this.data.type=r.item.type,this.data.pp=r.item.pp,"DAT"===r.item.type&&t.sgroupData.has(n)&&(t.clearVisel(t.sgroupData.get(n).visel),t.sgroupData.unset(n)),t.clearVisel(r.visel),0!==r.item.atoms.length)throw new Error("S-Group not empty!");t.sgroups.unset(n),e.sgroups.remove(n)},this.invert=function(){var t=new d;return t.data=this.data,t}}function m(t,e,n){this.type="OpSGroupAddToHierarchy",this.data={sgid:t,parent:e,children:n},this.execute=function(t){var r=t.molecule,o=this.data.sgid,i=r.sGroupForest.insert(o,e,n);this.data.parent=i.parent,this.data.children=i.children},this.invert=function(){var t=new g;return t.data=this.data,t}}function g(t){this.type="OpSGroupRemoveFromHierarchy",this.data={sgid:t},this.execute=function(t){var e=t.molecule,n=this.data.sgid;this.data.parent=e.sGroupForest.parent.get(n),this.data.children=e.sGroupForest.children.get(n),e.sGroupForest.remove(n)},this.invert=function(){var t=new m;return t.data=this.data,t}}function v(t,e,n){this.data={bid:null,bond:n,begin:t,end:e},this.execute=function(t){var e=t.molecule;if(this.data.begin==this.data.end)throw new Error("Distinct atoms expected");if(Y.debug&&this.molecule.checkBondExists(this.data.begin,this.data.end))throw new Error("Bond already exists");F(t,this.data.begin,1),F(t,this.data.end,1);var n={};if(this.data.bond)for(var r in this.data.bond)this.data.bond.hasOwnProperty(r)&&(n[r]=this.data.bond[r]);n.type=n.type||q.Bond.PATTERN.TYPE.SINGLE,n.begin=this.data.begin,n.end=this.data.end,"number"!=typeof this.data.bid?this.data.bid=e.bonds.add(new q.Bond(n)):e.bonds.set(this.data.bid,new q.Bond(n)),e.bondInitHalfBonds(this.data.bid),e.atomAddNeighbor(e.bonds.get(this.data.bid).hb1),e.atomAddNeighbor(e.bonds.get(this.data.bid).hb2),t.bonds.set(this.data.bid,new K.Bond(t.molecule.bonds.get(this.data.bid))),t.markBond(this.data.bid,1)},this.invert=function(){var t=new b;return t.data=this.data,t}}function b(t){this.data={bid:t,bond:null,begin:null,end:null},this.execute=function(t){var e=t.molecule;this.data.bond||(this.data.bond=e.bonds.get(this.data.bid),this.data.begin=this.data.bond.begin,this.data.end=this.data.bond.end),z(t,this.data.bid);var n=t.bonds.get(this.data.bid);[n.b.hb1,n.b.hb2].forEach(function(e){var n=t.molecule.halfBonds.get(e);n.loop>=0&&t.loopRemove(n.loop)},t),t.clearVisel(n.visel),t.bonds.unset(this.data.bid),t.markItemRemoved();var r=e.bonds.get(this.data.bid);[r.hb1,r.hb2].forEach(function(t){var n=e.halfBonds.get(t),r=e.atoms.get(n.begin),o=r.neighbors.indexOf(t),i=(o+r.neighbors.length-1)%r.neighbors.length,a=(o+1)%r.neighbors.length;e.setHbNext(r.neighbors[i],r.neighbors[a]),r.neighbors.splice(o,1)},this),e.halfBonds.unset(r.hb1),e.halfBonds.unset(r.hb2),e.bonds.remove(this.data.bid)},this.invert=function(){var t=new v;return t.data=this.data,t}}function y(t,e,n){this.data={bid:t,attribute:e,value:n},this.data2=null,
this.execute=function(t){var e=t.molecule.bonds.get(this.data.bid);this.data2||(this.data2={bid:this.data.bid,attribute:this.data.attribute,value:e[this.data.attribute]}),e[this.data.attribute]=this.data.value,z(t,this.data.bid),"type"===this.data.attribute&&G(t,this.data.bid)},this._isDummy=function(t){return t.molecule.bonds.get(this.data.bid)[this.data.attribute]==this.data.value},this.invert=function(){var t=new y;return t.data=this.data2,t.data2=this.data,t}}function _(t){this.frid=void 0===t?null:t,this.execute=function(t){var e=t.molecule,n={};null==this.frid?this.frid=e.frags.add(n):e.frags.set(this.frid,n),t.frags.set(this.frid,new K.Frag(n))},this.invert=function(){return new x(this.frid)}}function x(t){this.frid=t,this.execute=function(t){var e=t.molecule;U(t,"frags",this.frid,1),t.frags.unset(this.frid),e.frags.remove(this.frid)},this.invert=function(){return new _(this.frid)}}function w(t,e,n){this.data={rgid:t,attribute:e,value:n},this.data2=null,this.execute=function(t){var e=t.molecule.rgroups.get(this.data.rgid);this.data2||(this.data2={rgid:this.data.rgid,attribute:this.data.attribute,value:e[this.data.attribute]}),e[this.data.attribute]=this.data.value,U(t,"rgroups",this.data.rgid)},this._isDummy=function(t){return t.molecule.rgroups.get(this.data.rgid)[this.data.attribute]==this.data.value},this.invert=function(){var t=new w;return t.data=this.data2,t.data2=this.data,t}}function S(t,e,n){this.type="OpAddOrDeleteRGFragment",this.rgid_new=t,this.rg_new=n,this.rgid_old=null,this.rg_old=null,this.frid=e,this.execute=function(t){var e=t.molecule;if(this.rgid_old=this.rgid_old||q.RGroup.findRGroupByFragment(e.rgroups,this.frid),this.rg_old=this.rgid_old?e.rgroups.get(this.rgid_old):null,this.rg_old&&(this.rg_old.frags.remove(this.rg_old.frags.keyOf(this.frid)),t.clearVisel(t.rgroups.get(this.rgid_old).visel),0===this.rg_old.frags.count()?(t.rgroups.unset(this.rgid_old),e.rgroups.unset(this.rgid_old),t.markItemRemoved()):t.markItem("rgroups",this.rgid_old,1)),this.rgid_new){var n=e.rgroups.get(this.rgid_new);n?t.markItem("rgroups",this.rgid_new,1):(n=this.rg_new||new q.RGroup,e.rgroups.set(this.rgid_new,n),t.rgroups.set(this.rgid_new,new K.RGroup(n))),n.frags.add(this.frid)}},this.invert=function(){return new S(this.rgid_old,this.frid,this.rg_old)}}function O(t,e){this.type="OpUpdateIfThenValues",this.rgid_new=t,this.rgid_old=e,this.ifThenHistory={},this.execute=function(t){var e=this,n=t.molecule;n.rgroups.keys().forEach(function(t){var r=n.rgroups.get(t);r.ifthen===e.rgid_old&&(r.ifthen=e.rgid_new,e.ifThenHistory[t]=e.rgid_old,n.rgroups.set(t,r))})},this.invert=function(){return new A(this.rgid_new,this.rgid_old,this.ifThenHistory)}}function A(t,e,n){this.type="OpRestoreIfThenValues",this.rgid_new=t,this.rgid_old=e,this.ifThenHistory=n||{},this.execute=function(t){var e=this,n=t.molecule;Object.keys(this.ifThenHistory).forEach(function(t){var r=n.rgroups.get(t);r.ifthen=e.ifThenHistory[t],n.rgroups.set(t,r)})},this.invert=function(){return new O(this.rgid_old,this.rgid_new)}}function E(t){this.data={arid:null,pos:t},this.execute=function(t){var e=t.molecule;"number"!=typeof this.data.arid?this.data.arid=e.rxnArrows.add(new q.RxnArrow):e.rxnArrows.set(this.data.arid,new q.RxnArrow),t.rxnArrows.set(this.data.arid,new K.RxnArrow(t.molecule.rxnArrows.get(this.data.arid))),e.rxnArrowSetPos(this.data.arid,new W(this.data.pos)),U(t,"rxnArrows",this.data.arid,1)},this.invert=function(){var t=new j;return t.data=this.data,t}}function j(t){this.data={arid:t,pos:null},this.execute=function(t){var e=t.molecule;this.data.pos||(this.data.pos=e.rxnArrows.get(this.data.arid).pp),t.markItemRemoved(),t.clearVisel(t.rxnArrows.get(this.data.arid).visel),t.rxnArrows.unset(this.data.arid),e.rxnArrows.remove(this.data.arid)},this.invert=function(){var t=new E;return t.data=this.data,t}}function P(t,e,n){this.data={id:t,d:e,noinvalidate:n},this.execute=function(t){var e=t.molecule,n=this.data.id,r=this.data.d;e.rxnArrows.get(n).pp.add_(r),t.rxnArrows.get(n).visel.translate(V.obj2scaled(r,t.render.options)),this.data.d=r.negated(),this.data.noinvalidate||U(t,"rxnArrows",n,1)},this.invert=function(){var t=new P;return t.data=this.data,t}}function T(t){this.data={plid:null,pos:t},this.execute=function(t){var e=t.molecule;"number"!=typeof this.data.plid?this.data.plid=e.rxnPluses.add(new q.RxnPlus):e.rxnPluses.set(this.data.plid,new q.RxnPlus),t.rxnPluses.set(this.data.plid,new K.RxnPlus(t.molecule.rxnPluses.get(this.data.plid))),e.rxnPlusSetPos(this.data.plid,new W(this.data.pos)),U(t,"rxnPluses",this.data.plid,1)},this.invert=function(){var t=new C;return t.data=this.data,t}}function C(t){this.data={plid:t,pos:null},this.execute=function(t){var e=t.molecule;this.data.pos||(this.data.pos=e.rxnPluses.get(this.data.plid).pp),t.markItemRemoved(),t.clearVisel(t.rxnPluses.get(this.data.plid).visel),t.rxnPluses.unset(this.data.plid),e.rxnPluses.remove(this.data.plid)},this.invert=function(){var t=new T;return t.data=this.data,t}}function R(t,e,n){this.data={id:t,d:e,noinvalidate:n},this.execute=function(t){var e=t.molecule,n=this.data.id,r=this.data.d;e.rxnPluses.get(n).pp.add_(r),t.rxnPluses.get(n).visel.translate(V.obj2scaled(r,t.render.options)),this.data.d=r.negated(),this.data.noinvalidate||U(t,"rxnPluses",n,1)},this.invert=function(){var t=new R;return t.data=this.data,t}}function N(t,e){this.data={id:t,d:e},this.execute=function(t){t.molecule.sgroups.get(this.data.id).pp.add_(this.data.d),this.data.d=this.data.d.negated(),U(t,"sgroupData",this.data.id,1)},this.invert=function(){var t=new N;return t.data=this.data,t}}function k(t){this.data={struct:t},this.execute=function(t){var e=t.molecule;t.clearVisels(),t.render.setMolecule(this.data.struct),this.data.struct=e},this.invert=function(){var t=new k;return t.data=this.data,t}}function I(t){this.data={pos:t},this.execute=function(e){var n=e.molecule;e.chiralFlags.count()>0&&(e.clearVisel(e.chiralFlags.get(0).visel),e.chiralFlags.unset(0)),e.chiralFlags.set(0,new K.ChiralFlag(t)),n.isChiral=!0,U(e,"chiralFlags",0,1)},this.invert=function(){var t=new B;return t.data=this.data,t}}function B(){this.data={pos:null},this.execute=function(t){var e=t.molecule;if(t.chiralFlags.count()<1)throw new Error("Cannot remove chiral flag");t.clearVisel(t.chiralFlags.get(0).visel),this.data.pos=t.chiralFlags.get(0).pp,t.chiralFlags.unset(0),e.isChiral=!1},this.invert=function(){var t=new I(this.data.pos);return t.data=this.data,t}}function M(t){this.data={d:t},this.execute=function(t){t.chiralFlags.get(0).pp.add_(this.data.d),this.data.d=this.data.d.negated(),U(t,"chiralFlags",0,1)},this.invert=function(){var t=new M;return t.data=this.data,t}}function L(){this.type="OpAlignDescriptors",this.history={},this.execute=function(t){var e=this,n=t.molecule.sgroups.values().reverse(),r=n.reduce(function(t,e){return new W(Math.max(e.bracketBox.p1.x,t.x),Math.min(e.bracketBox.p0.y,t.y))},new W(0,1/0)).add(new W(.5,-.5));n.forEach(function(n){e.history[n.id]=n.pp,r=r.add(new W(0,.5)),n.pp=r,t.molecule.sgroups.set(n.id,n)})},this.invert=function(){return new D(this.history)}}function D(t){this.type="OpRestoreDescriptorsPosition",this.history=t,this.execute=function(t){var e=this;t.molecule.sgroups.values().forEach(function(n){n.pp=e.history[n.id],t.molecule.sgroups.set(n.id,n)})},this.invert=function(){return new L}}function F(t,e,n){var r=t.atoms.get(e);t.markAtom(e,n?1:0);for(var o=t.molecule.halfBonds,i=0;i<r.a.neighbors.length;++i){var a=r.a.neighbors[i];if(o.has(a)){var s=o.get(a);t.markBond(s.bid,1),t.markAtom(s.end,0),n&&G(t,s.bid)}}}function G(t,e){var n=t.bonds.get(e),r=t.molecule.halfBonds.get(n.b.hb1).loop,o=t.molecule.halfBonds.get(n.b.hb2).loop;r>=0&&t.loopRemove(r),o>=0&&t.loopRemove(o)}function z(t,e){var n=t.bonds.get(e);G(t,e),F(t,n.b.begin,0),F(t,n.b.end,0)}function U(t,e,n,r){"atoms"===e?F(t,n,r):"bonds"===e?(z(t,n),r>0&&G(t,n)):t.markItem(e,n,r)}var W=t("../util/vec2"),H=t("../util/set"),V=t("../util/scale"),q=t("../chem/struct"),K=t("../render/restruct"),Y={debug:!1,logcnt:0,logmouse:!1,hl:!1};Y.logMethod=function(){},o.prototype=new r,i.prototype=new r,a.prototype=new r,s.prototype=new r,u.prototype=new r,c.prototype=new r,l.prototype=new r,f.prototype=new r,p.prototype=new r,d.prototype=new r,h.prototype=new r,m.prototype=new r,g.prototype=new r,v.prototype=new r,b.prototype=new r,y.prototype=new r,_.prototype=new r,x.prototype=new r,w.prototype=new r,S.prototype=new r,O.prototype=new r,A.prototype=new r,E.prototype=new r,j.prototype=new r,P.prototype=new r,T.prototype=new r,C.prototype=new r,R.prototype=new r,N.prototype=new r,k.prototype=new r,I.prototype=new r,B.prototype=new r,M.prototype=new r,L.prototype=new r,D.prototype=new r,e.exports={AtomAdd:o,AtomDelete:i,AtomAttr:a,AtomMove:s,BondMove:u,LoopMove:c,SGroupAtomAdd:l,SGroupAtomRemove:f,SGroupAttr:p,SGroupCreate:d,SGroupDelete:h,SGroupAddToHierarchy:m,SGroupRemoveFromHierarchy:g,BondAdd:v,BondDelete:b,BondAttr:y,FragmentAdd:_,FragmentDelete:x,RGroupAttr:w,RGroupFragment:S,RxnArrowAdd:E,RxnArrowDelete:j,RxnArrowMove:P,RxnPlusAdd:T,RxnPlusDelete:C,RxnPlusMove:R,SGroupDataMove:N,CanvasLoad:k,ChiralFlagAdd:I,ChiralFlagDelete:B,ChiralFlagMove:M,UpdateIfThen:O,AlignDescriptors:L,RestoreDescriptorsPosition:D}},{"../chem/struct":533,"../render/restruct":567,"../util/scale":655,"../util/set":656,"../util/vec2":657}],541:[function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.editor=t,this.editor.selection(null)}var o=t("../action");r.prototype.mousemove=function(t){this.editor.hover(this.editor.findItem(t,["atoms"]))},r.prototype.mouseup=function(t){var e=this.editor,n=e.render.ctab.molecule,r=e.findItem(t,["atoms"]);if(r&&"atoms"===r.map){this.editor.hover(null);var i=n.atoms.get(r.id),a=e.event.elementEdit.dispatch({attpnt:i.attpnt});return Promise.resolve(a).then(function(t){if(i.attpnt!=t.attpnt){var n=o.fromAtomsAttrs(e.render.ctab,r.id,t);e.update(n)}}),!0}},e.exports=r},{"../action":537}],542:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r)){if(!t.selection()||!t.selection().atoms)return new r(t,e);var n=a.fromAtomsAttrs(t.render.ctab,t.selection().atoms,e,!0);return t.update(n),t.selection(null),null}this.editor=t,this.atomProps=e,this.bondProps={type:1,stereo:i.Bond.PATTERN.STEREO.NONE}}function o(t,e){var n=t.dragCtx,r=t.editor,o=n.item&&n.item.id,s=o?e.ctab.molecule.atoms.get(o):new i.Atom({label:""});n.timeout=setTimeout(function(){delete t.dragCtx,r.selection(null);var i=r.event.quickEdit.dispatch(s);Promise.resolve(i).then(function(t){var i=o?a.fromAtomsAttrs(e.ctab,o,t):a.fromAtomAddition(e.ctab,n.xy0,t);r.update(i)})},750),n.stopTapping=function(){n.timeout&&(clearTimeout(n.timeout),delete t.dragCtx.timeout)}}var i=t("../../chem/struct"),a=t("../action"),s=t("./utils");r.prototype.mousedown=function(t){this.editor.hover(null);var e=this.editor.findItem(t,["atoms"]);e?"atoms"===e.map&&(this.dragCtx={item:e}):this.dragCtx={}},r.prototype.mousemove=function(t){var e=this.editor.render;if(!this.dragCtx||!this.dragCtx.item)return void this.editor.hover(this.editor.findItem(t,["atoms"]));var n=this.dragCtx,r=this.editor.findItem(t,["atoms"]);if(r&&"atoms"===r.map&&r.id===n.item.id)return void this.editor.hover(this.editor.findItem(t,["atoms"]));var o=e.ctab.molecule.atoms.get(n.item.id),i=s.calcNewAtomPos(o.pp,e.page2obj(t));n.action&&n.action.perform(e.ctab),n.action=a.fromBondAddition(e.ctab,this.bondProps,n.item.id,Object.assign({},this.atomProps),i,i)[0],this.editor.update(n.action,!0)},r.prototype.mouseup=function(t){if(this.dragCtx){var e=this.dragCtx,n=this.editor.render;this.editor.update(e.action||(e.item?a.fromAtomsAttrs(n.ctab,e.item.id,this.atomProps,!0):a.fromAtomAddition(n.ctab,n.page2obj(t),this.atomProps))),delete this.dragCtx}},e.exports=Object.assign(r,{atomLongtapEvent:o})},{"../../chem/struct":533,"../action":537,"./utils":562}],543:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r))return new r(t,e);this.attach=e||{atomid:0,bondid:0},this.editor=t,this.editor.selection({atoms:[this.attach.atomid],bonds:[this.attach.bondid]})}var o=t("../../chem/element");r.prototype.mousemove=function(t){var e=this.editor.render,n=this.editor.findItem(t,["atoms","bonds"]),r=e.ctab.molecule;return n&&("atoms"===n.map&&o.map[r.atoms.get(n.id).label]||"bonds"===n.map)?this.editor.hover(n):this.editor.hover(null),!0},r.prototype.mouseup=function(t){var e=this.editor,n=e.render,r=n.ctab.molecule,i=e.findItem(t,["atoms","bonds"]);return i&&("atoms"===i.map&&o.map[r.atoms.get(i.id).label]||"bonds"===i.map)&&("atoms"===i.map?this.attach.atomid=i.id:this.attach.bondid=i.id,this.editor.selection({atoms:[this.attach.atomid],bonds:[this.attach.bondid]}),this.editor.event.attachEdit.dispatch(this.attach)),!0},e.exports=r},{"../../chem/element":516}],544:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r))return t.selection(null),new r(t,e);this.editor=t,this.atomProps={label:"C"},this.bondProps=e}function o(t,e,n,r){if(r.stereo!==s.Bond.PATTERN.STEREO.NONE&&r.type===s.Bond.PATTERN.TYPE.SINGLE&&n.type===r.type&&n.stereo===r.stereo)return u.fromBondFlipping(t,e);var o=l.indexOf(r.type)>=0?l:null;return r.stereo===s.Bond.PATTERN.STEREO.NONE&&r.type===s.Bond.PATTERN.TYPE.SINGLE&&n.stereo===s.Bond.PATTERN.STEREO.NONE&&o&&(r.type=o[(o.indexOf(n.type)+1)%o.length]),u.fromBondAttrs(t,e,r,i(t.molecule,n,r))}function i(t,e,n){return n.type==s.Bond.PATTERN.TYPE.SINGLE&&e.stereo==s.Bond.PATTERN.STEREO.NONE&&n.stereo!=s.Bond.PATTERN.STEREO.NONE&&t.atoms.get(e.begin).neighbors.length<t.atoms.get(e.end).neighbors.length}var a=t("../../util/vec2"),s=t("../../chem/struct"),u=t("../action"),c=t("./utils");r.prototype.mousedown=function(t){var e=this.editor.render;return this.editor.hover(null),this.dragCtx={xy0:e.page2obj(t),item:this.editor.findItem(t,["atoms","bonds"])},this.dragCtx.item||delete this.dragCtx.item,!0},r.prototype.mousemove=function(t){var e=this.editor,n=e.render;if("dragCtx"in this){var r=this.dragCtx;if(!("item"in r)||"atoms"===r.item.map){"action"in r&&r.action.perform(n.ctab);var o,i,s,l;"item"in r&&"atoms"===r.item.map?(o=r.item.id,i=e.findItem(t,["atoms"],r.item)):(o=this.atomProps,s=r.xy0,i=e.findItem(t,["atoms"]));var f=Number.MAX_VALUE;if(i&&"atoms"===i.map)i=i.id;else{i=this.atomProps;var p=n.page2obj(t);if(f=a.dist(r.xy0,p),s)l=c.calcNewAtomPos(s,p);else{var d=n.ctab.molecule.atoms.get(o);s=c.calcNewAtomPos(d.pp.get_xy0(),p)}}return f>.3?r.action=u.fromBondAddition(n.ctab,this.bondProps,o,i,s,l)[0]:delete r.action,this.editor.update(r.action,!0),!0}}return this.editor.hover(this.editor.findItem(t,["atoms","bonds"])),!0},r.prototype.mouseup=function(t){if("dragCtx"in this){var e=this.dragCtx,n=this.editor.render,r=n.ctab.molecule;if("action"in e)this.editor.update(e.action);else if("item"in e){if("atoms"===e.item.map)this.editor.update(u.fromBondAddition(n.ctab,this.bondProps,e.item.id)[0]);else if("bonds"===e.item.map){var i=Object.assign({},this.bondProps),c=r.bonds.get(e.item.id);this.editor.update(o(n.ctab,e.item.id,c,i))}}else{var l=n.page2obj(t),f=new a(.5,0).rotate(this.bondProps.type==s.Bond.PATTERN.TYPE.SINGLE?-Math.PI/6:0),p=u.fromBondAddition(n.ctab,this.bondProps,{label:"C"},{label:"C"},a.diff(l,f),a.sum(l,f));this.editor.update(p[0])}delete this.dragCtx}return!0};var l=[s.Bond.PATTERN.TYPE.SINGLE,s.Bond.PATTERN.TYPE.DOUBLE,s.Bond.PATTERN.TYPE.TRIPLE];e.exports=Object.assign(r,{bondChangingAction:o})},{"../../chem/struct":533,"../../util/vec2":657,"../action":537,"./utils":562}],545:[function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.editor=t,this.editor.selection(null)}var o=t("../../util/vec2"),i=t("../../chem/struct"),a=t("../action"),s=t("./utils"),u=t("./atom"),c=t("./bond");r.prototype.mousedown=function(t){var e=this.editor.render,n=this.editor.findItem(t,["atoms","bonds"]);return this.editor.hover(null),this.dragCtx={xy0:e.page2obj(t),item:n},n&&"atoms"===n.map&&(this.editor.selection({atoms:[n.id]}),u.atomLongtapEvent(this,e)),this.dragCtx.item||delete this.dragCtx.item,!0},r.prototype.mousemove=function(t){var e=this.editor,n=e.render;if(this.dragCtx){"stopTapping"in this.dragCtx&&this.dragCtx.stopTapping(),this.editor.selection(null);var r=this.dragCtx;if(!("item"in r)||"atoms"===r.item.map){"action"in r&&r.action.perform(n.ctab);var i=n.ctab.molecule.atoms,u=r.item?i.get(r.item.id).pp:r.xy0,c=n.page2obj(t),l=Math.ceil(o.diff(c,u).length()),f=t.ctrlKey?s.calcAngle(u,c):s.fracAngle(u,c);return r.action=a.fromChain(n.ctab,u,f,l,r.item?r.item.id:null),e.event.message.dispatch({info:l+" sectors"}),this.editor.update(r.action,!0),!0}}return this.editor.hover(this.editor.findItem(t,["atoms","bonds"])),!0},r.prototype.mouseup=function(){var t=this.editor.render,e=t.ctab.molecule;if(this.dragCtx){"stopTapping"in this.dragCtx&&this.dragCtx.stopTapping();var n=this.dragCtx,r=n.action;if(!r&&n.item&&"bonds"===n.item.map){var o=e.bonds.get(n.item.id);r=c.bondChangingAction(t.ctab,n.item.id,o,{type:i.Bond.PATTERN.TYPE.SINGLE,stereo:i.Bond.PATTERN.STEREO.NONE})}delete this.dragCtx,r&&this.editor.update(r)}return!0},r.prototype.cancel=r.prototype.mouseleave=r.prototype.mouseup,e.exports=r},{"../../chem/struct":533,"../../util/vec2":657,"../action":537,"./atom":542,"./bond":544,"./utils":562}],546:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r))return new r(t,e);this.editor=t,this.editor.selection(null),this.charge=e}var o=t("../action"),i=t("../../chem/element");r.prototype.mousemove=function(t){var e=this.editor.render,n=this.editor.findItem(t,["atoms"]),r=e.ctab.molecule;return n&&"atoms"===n.map&&i.map[r.atoms.get(n.id).label]?this.editor.hover(n):this.editor.hover(null),!0},r.prototype.mouseup=function(t){var e=this.editor,n=e.render,r=n.ctab.molecule,a=e.findItem(t,["atoms"]);return a&&"atoms"===a.map&&i.map[r.atoms.get(a.id).label]&&(this.editor.hover(null),this.editor.update(o.fromAtomsAttrs(n.ctab,a.id,{charge:r.atoms.get(a.id).charge+this.charge}))),!0},e.exports=r},{"../../chem/element":516,"../action":537}],547:[function(t,e,n){"use strict";function r(t){if(!(this instanceof r)){this.editor=t;var e=this.editor.render,n=null;n=!1===e.ctab.molecule.isChiral?o.fromChiralFlagAddition(e.ctab):o.fromChiralFlagDeletion(e.ctab),this.editor.update(n)}}var o=t("../action");e.exports=r},{"../action":537}],548:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r)){if(!t.selection())return new r(t,e);var n=o.fromFragmentDeletion(t.render.ctab,t.selection());return t.update(n),t.selection(null),null}this.editor=t,this.maps=["atoms","bonds","rxnArrows","rxnPluses","sgroups","sgroupData","chiralFlags"],this.lassoHelper=new i(e||0,t)}var o=t("../action"),i=t("./helper/lasso");r.prototype.mousedown=function(t){this.editor.findItem(t,this.maps)||this.lassoHelper.begin(t)},r.prototype.mousemove=function(t){this.lassoHelper.running()?this.editor.selection(this.lassoHelper.addPoint(t)):this.editor.hover(this.editor.findItem(t,this.maps))},r.prototype.mouseleave=function(t){this.lassoHelper.running(t)&&this.lassoHelper.end(t)},r.prototype.mouseup=function(t){var e=this.editor.render;if(this.lassoHelper.running())this.editor.update(o.fromFragmentDeletion(e.ctab,this.lassoHelper.end(t))),this.editor.selection(null);else{var n=this.editor.findItem(t,this.maps);if(n){if(this.editor.hover(null),"atoms"===n.map)this.editor.update(o.fromAtomDeletion(e.ctab,n.id));else if("bonds"===n.map)this.editor.update(o.fromBondDeletion(e.ctab,n.id));else if("sgroups"===n.map||"sgroupData"===n.map)this.editor.update(o.fromSgroupDeletion(e.ctab,n.id));else if("rxnArrows"===n.map)this.editor.update(o.fromArrowDeletion(e.ctab,n.id));else if("rxnPluses"===n.map)this.editor.update(o.fromPlusDeletion(e.ctab,n.id));else{if("chiralFlags"!==n.map)return void console.error("EraserTool: unable to delete the object "+n.map+"["+n.id+"]");this.editor.update(o.fromChiralFlagDeletion(e.ctab))}this.editor.selection(null)}}},e.exports=r},{"../action":537,"./helper/lasso":549}],549:[function(t,e,n){"use strict";function r(t,e,n){this.mode=t,this.fragment=n,this.editor=e}var o=t("./locate"),i=t("../../../render/draw"),a=t("../../../util/scale");r.prototype.getSelection=function(){var t=this.editor.render;if(0==this.mode)return o.inPolygon(t.ctab,this.points);if(1==this.mode)return o.inRectangle(t.ctab,this.points[0],this.points[1]);throw new Error("Selector mode unknown")},r.prototype.begin=function(t){var e=this.editor.render;this.points=[e.page2obj(t)],1==this.mode&&this.points.push(this.points[0])},r.prototype.running=function(){return!!this.points},r.prototype.addPoint=function(t){if(this.points){var e=this.editor.render;return 0==this.mode?this.points.push(e.page2obj(t)):1==this.mode&&(this.points=[this.points[0],e.page2obj(t)]),this.update(),this.getSelection()}return null},r.prototype.update=function(){if(this.selection&&(this.selection.remove(),this.selection=null),this.points&&this.points.length>1){var t=this.editor.render,e=this.points.map(function(e){return a.obj2scaled(e,t.options).add(t.options.offset)});this.selection=0==this.mode?i.selectionPolygon(t.paper,e,t.options):i.selectionRectangle(t.paper,e[0],e[1],t.options)}},r.prototype.end=function(){var t=this.getSelection();return this.points=null,this.update(null),t},e.exports=r},{"../../../render/draw":564,"../../../util/scale":655,"./locate":550}],550:[function(t,e,n){"use strict";function r(t,e,n){var r=[],o=[],i=Math.min(e.x,n.x),s=Math.max(e.x,n.x),u=Math.min(e.y,n.y),c=Math.max(e.y,n.y);t.bonds.each(function(e,n){var o=a.lc2(t.atoms.get(n.b.begin).a.pp,.5,t.atoms.get(n.b.end).a.pp,.5);o.x>i&&o.x<s&&o.y>u&&o.y<c&&r.push(e)}),t.atoms.each(function(t,e){e.a.pp.x>i&&e.a.pp.x<s&&e.a.pp.y>u&&e.a.pp.y<c&&o.push(t)});var l=[],f=[];t.rxnArrows.each(function(t,e){e.item.pp.x>i&&e.item.pp.x<s&&e.item.pp.y>u&&e.item.pp.y<c&&l.push(t)}),t.rxnPluses.each(function(t,e){e.item.pp.x>i&&e.item.pp.x<s&&e.item.pp.y>u&&e.item.pp.y<c&&f.push(t)});var p=[];t.chiralFlags.each(function(t,e){e.pp.x>i&&e.pp.x<s&&e.pp.y>u&&e.pp.y<c&&p.push(t)});var d=[];return t.sgroupData.each(function(t,e){e.sgroup.pp.x>i&&e.sgroup.pp.x<s&&e.sgroup.pp.y>u&&e.sgroup.pp.y<c&&d.push(t)}),{atoms:o,bonds:r,rxnArrows:l,rxnPluses:f,chiralFlags:p,sgroupData:d}}function o(t,e){for(var n=[],r=[],o=[],s=0;s<e.length;++s)o[s]=new a(e[s].x,e[s].y);t.bonds.each(function(e,r){var s=a.lc2(t.atoms.get(r.b.begin).a.pp,.5,t.atoms.get(r.b.end).a.pp,.5);i(o,s)&&n.push(e)}),t.atoms.each(function(t,e){i(o,e.a.pp)&&r.push(t)});var u=[],c=[];t.rxnArrows.each(function(t,e){i(o,e.item.pp)&&u.push(t)}),t.rxnPluses.each(function(t,e){i(o,e.item.pp)&&c.push(t)});var l=[];t.chiralFlags.each(function(t,e){i(o,e.pp)&&l.push(t)});var f=[];return t.sgroupData.each(function(t,e){i(o,e.sgroup.pp)&&f.push(t)}),{atoms:r,bonds:n,rxnArrows:u,rxnPluses:c,chiralFlags:l,sgroupData:f}}function i(t,e){for(var n=new a(0,1),r=n.rotate(Math.PI/2),o=a.diff(t[t.length-1],e),i=a.dot(r,o),s=a.dot(n,o),u=null,c=0,l=!1,f=!1,p=0;p<t.length;++p){var d=a.diff(t[p],e),h=a.diff(d,o),m=a.dot(r,d),g=a.dot(n,d);l=!1,m*i<0&&(g*s>-1e-5?s>-1e-5&&(l=!0):(Math.abs(i)*Math.abs(g)-Math.abs(m)*Math.abs(s))*g>0&&(l=!0)),l&&f&&a.dot(h,r)*a.dot(u,r)>=0&&(l=!1),l&&c++,o=d,i=m,s=g,u=h,f=l}return c%2!=0}var a=t("../../../util/vec2");e.exports={inRectangle:r,inPolygon:o}},{"../../../util/vec2":657}],551:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r))return new r(t,e);this.editor=t,this.editor.selection(null),this.struct=e;var n=t.render,i=t.lastEvent?n.page2obj(t.lastEvent):null;this.action=o.fromPaste(n.ctab,this.struct,i),this.editor.update(this.action,!0)}var o=t("../action");r.prototype.mousemove=function(t){var e=this.editor.render;this.action&&this.action.perform(e.ctab),this.action=o.fromPaste(e.ctab,this.struct,e.page2obj(t)),this.editor.update(this.action,!0)},r.prototype.mouseup=function(){if(this.action){var t=this.action;delete this.action,this.editor.update(t)}},r.prototype.cancel=r.prototype.mouseleave=function(){var t=this.editor.render;this.action&&(this.action.perform(t.ctab),delete this.action,t.update())},e.exports=r},{"../action":537}],552:[function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.editor=t,this.editor.selection(null)}var o=t("../action");r.prototype.mousedown=function(t){var e=this.editor.render,n=this.editor.findItem(t,["rxnArrows"]);n&&"rxnArrows"===n.map&&(this.editor.hover(null),this.editor.selection({rxnArrows:[n.id]}),this.dragCtx={xy0:e.page2obj(t),action:new o})},r.prototype.mousemove=function(t){var e=this.editor.render;"dragCtx"in this?(this.dragCtx.action&&this.dragCtx.action.perform(e.ctab),this.dragCtx.action=o.fromMultipleMove(e.ctab,this.editor.selection()||{},e.page2obj(t).sub(this.dragCtx.xy0)),this.editor.update(this.dragCtx.action,!0)):this.editor.hover(this.editor.findItem(t,["rxnArrows"]))},r.prototype.mouseup=function(t){var e=this.editor.render;this.dragCtx?(this.editor.update(this.dragCtx.action),delete this.dragCtx):e.ctab.molecule.rxnArrows.count()<1&&this.editor.update(o.fromArrowAddition(e.ctab,e.page2obj(t)))},e.exports=r},{"../action":537}],553:[function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.editor=t,this.editor.selection(null),this.rcs=this.editor.render.ctab.molecule.getComponents()}function o(t,e,n){for(var r,o,a=0;(!r||!o)&&a<t.reactants.length;a++){var s=i.list(t.reactants[a]);!r&&s.indexOf(e)>=0&&(r="r"),!o&&s.indexOf(n)>=0&&(o="r")}for(var u=0;(!r||!o)&&u<t.products.length;u++){var c=i.list(t.products[u]);!r&&c.indexOf(e)>=0&&(r="p"),!o&&c.indexOf(n)>=0&&(o="p")}return r&&o&&r!=o}var i=t("../../util/set"),a=t("../../util/scale"),s=t("../action"),u=t("../../render/draw");r.prototype.mousedown=function(t){var e=this.editor.render,n=this.editor.findItem(t,["atoms"]);n&&"atoms"===n.map&&(this.editor.hover(null),this.dragCtx={item:n,xy0:e.page2obj(t)})},r.prototype.mousemove=function(t){var e=this.editor.render;if("dragCtx"in this){var n=this.editor.findItem(t,["atoms"],this.dragCtx.item),r=e.ctab.molecule.atoms;n&&"atoms"===n.map&&o(this.rcs,this.dragCtx.item.id,n.id)?(this.editor.hover(n),this.updateLine(r.get(this.dragCtx.item.id).pp,r.get(n.id).pp)):(this.editor.hover(null),this.updateLine(r.get(this.dragCtx.item.id).pp,e.page2obj(t)))}else this.editor.hover(this.editor.findItem(t,["atoms"]))},r.prototype.updateLine=function(t,e){if(this.line&&(this.line.remove(),this.line=null),t&&e){var n=this.editor.render;this.line=u.selectionLine(n.paper,a.obj2scaled(t,n.options).add(n.options.offset),a.obj2scaled(e,n.options).add(n.options.offset),n.options)}},r.prototype.mouseup=function(t){if("dragCtx"in this){var e=this.editor.render,n=this.editor.findItem(t,["atoms"],this.dragCtx.item);if(n&&"atoms"===n.map&&o(this.rcs,this.dragCtx.item.id,n.id)){var r=new s,i=e.ctab.molecule.atoms,a=i.get(this.dragCtx.item.id),u=i.get(n.id),c=a.aam,l=u.aam;if(!c||c!=l){if((c&&c!=l||!c&&l)&&i.each(function(t,n){t!=this.dragCtx.item.id&&(c&&n.aam==c||l&&n.aam==l)&&r.mergeWith(s.fromAtomsAttrs(e.ctab,t,{aam:0}))},this),c)r.mergeWith(s.fromAtomsAttrs(e.ctab,n.id,{aam:c}));else{var f=0;i.each(function(t,e){f=Math.max(f,e.aam||0)}),r.mergeWith(s.fromAtomsAttrs(e.ctab,this.dragCtx.item.id,{aam:f+1})),r.mergeWith(s.fromAtomsAttrs(e.ctab,n.id,{aam:f+1}))}this.editor.update(r)}}this.updateLine(null),delete this.dragCtx}this.editor.hover(null)},e.exports=r},{"../../render/draw":564,"../../util/scale":655,"../../util/set":656,"../action":537}],554:[function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.editor=t,this.editor.selection(null)}var o=t("../action");r.prototype.mousedown=function(t){var e=this.editor.render,n=this.editor.findItem(t,["rxnPluses"]);n&&"rxnPluses"===n.map&&(this.editor.hover(null),this.editor.selection({rxnPluses:[n.id]}),this.dragCtx={xy0:e.page2obj(t)})},r.prototype.mousemove=function(t){var e=this.editor.render;"dragCtx"in this?(this.dragCtx.action&&this.dragCtx.action.perform(e.ctab),this.dragCtx.action=o.fromMultipleMove(e.ctab,this.editor.selection()||{},e.page2obj(t).sub(this.dragCtx.xy0)),this.editor.update(this.dragCtx.action,!0)):this.editor.hover(this.editor.findItem(t,["rxnPluses"]))},r.prototype.mouseup=function(t){var e=this.editor.render;this.dragCtx?(this.editor.update(this.dragCtx.action),delete this.dragCtx):this.editor.update(o.fromPlusAddition(e.ctab,e.page2obj(t)))},e.exports=r},{"../action":537}],555:[function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return new r(t);this.editor=t,this.editor.selection(null)}var o=t("../action");r.prototype.mousemove=function(t){var e=this.editor.findItem(t,["atoms"]);e&&"atoms"===e.map?this.editor.hover(this.editor.render.ctab.molecule.atoms.get(e.id).aam?e:null):this.editor.hover(null)},r.prototype.mouseup=function(t){var e=this.editor.findItem(t,["atoms"]),n=this.editor.render.ctab.molecule.atoms;if(e&&"atoms"===e.map&&n.get(e.id).aam){var r=new o,i=n.get(e.id).aam;n.each(function(t,e){e.aam==i&&r.mergeWith(o.fromAtomsAttrs(this.editor.render.ctab,t,{aam:0}))},this),this.editor.update(r)}this.editor.hover(null)},e.exports=r},{"../action":537}],556:[function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return t.selection(null),new r(t);this.editor=t}function o(t,e,n){var r=t.render.ctab.molecule,o=e||0===e?r.atoms.get(e):null,s=o?o.rglabel:0,u=o?o.label:"R#",c=t.event.elementEdit.dispatch({label:"R#",rglabel:s});Promise.resolve(c).then(function(r){r=Object.assign({},i.Atom.attrlist,r),!e&&0!==e&&r.rglabel?t.update(a.fromAtomAddition(t.render.ctab,n,r)):s==r.rglabel&&"R#"===u||(r.aam=o.aam,t.update(a.fromAtomsAttrs(t.render.ctab,e,r)))})}var i=t("../../chem/struct"),a=t("../action");r.prototype.mousemove=function(t){this.editor.hover(this.editor.findItem(t,["atoms"]))},r.prototype.mouseup=function(t){var e=this.editor.render,n=this.editor.findItem(t,["atoms"]);return n?"atoms"===n.map?(this.editor.hover(null),o(this.editor,n.id),!0):void 0:(this.editor.hover(null),o(this.editor,null,e.page2obj(t)),!0)},e.exports=r},{"../../chem/struct":533,"../action":537}],557:[function(t,e,n){"use strict";function r(t){if(!(this instanceof r))return t.selection(null),new r(t);this.editor=t}var o=t("../../chem/struct"),i=t("../action");r.prototype.mousemove=function(t){this.editor.hover(this.editor.findItem(t,["frags","rgroups"]))},r.prototype.mouseup=function(t){var e=this.editor,n=e.render.ctab.molecule,r=e.findItem(t,["frags","rgroups"]);if(r){this.editor.hover(null);var a="rgroups"===r.map?r.id:o.RGroup.findRGroupByFragment(n.rgroups,r.id)||null,s=Object.assign({label:a},"frags"===r.map?null:n.rgroups.get(r.id)),u=e.event.rgroupEdit.dispatch(s);return Promise.resolve(u).then(function(t){var n=e.render.ctab,a=null;if("rgroups"!==r.map){var s=o.RGroup.findRGroupByFragment(n.molecule.rgroups,r.id);a=i.fromRGroupFragment(n,t.label,r.id).mergeWith(i.fromUpdateIfThen(n,t.label,s))}else a=i.fromRGroupAttrs(n,r.id,t);e.update(a)}),!0}},e.exports=r},{"../../chem/struct":533,"../action":537}],558:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r)){if(!e)return new r(t);var n=t.render.ctab,o=t.selection(),a=o&&o.bonds&&1===Object.keys(o).length&&1==o.bonds.length,s=a?i.fromBondAlign(n,o.bonds[0],e):i.fromFlip(n,o,e);return t.update(s),null}this.editor=t,t.selection()&&t.selection().atoms||this.editor.selection(null)}var o=t("../../util/vec2"),i=t("../action"),a=t("./utils");r.prototype.mousedown=function(t){var e=new o,n=this.editor.selection(),r=this.editor.render,i=r.ctab.molecule;if(n&&n.atoms){console.assert(n.atoms.length>0);var s=null,u=!1;n.atoms.forEach(function(t){var r=i.atoms.get(t);e.add_(r.pp),u||r.neighbors.find(function(e){var r=i.halfBonds.get(e);if(-1===n.atoms.indexOf(r.end)){if(r.loop>=0){if(!i.atoms.get(t).neighbors.find(function(t){var e=i.halfBonds.get(t);return e.loop>=0&&-1!==n.atoms.indexOf(e.end)}))return u=!0,!0}
if(null==s)s=t;else if(s!=t)return u=!0,!0}return!1})}),e=u||null==s?e.scaled(1/n.atoms.length):i.atoms.get(s).pp}else i.atoms.each(function(t,n){e.add_(n.pp)}),e=e.scaled(1/i.atoms.count());return this.dragCtx={xy0:e,angle1:a.calcAngle(e,r.page2obj(t))},!0},r.prototype.mousemove=function(t){if("dragCtx"in this){var e=this.editor.render,n=this.dragCtx,r=e.page2obj(t),o=a.calcAngle(n.xy0,r)-n.angle1;t.ctrlKey||(o=a.fracAngle(o));var s=a.degrees(o);if("angle"in n&&n.angle==s)return!0;"action"in n&&n.action.perform(e.ctab),n.angle=s,n.action=i.fromRotate(e.ctab,this.editor.selection(),n.xy0,o),s>180?s-=360:s<=-180&&(s+=360),this.editor.event.message.dispatch({info:s+"º"}),this.editor.update(n.action,!0)}return!0},r.prototype.mouseup=function(){if(this.dragCtx){var t=this.dragCtx.action;delete this.dragCtx,t?this.editor.update(t):this.editor.selection(null)}return!0},r.prototype.cancel=r.prototype.mouseleave=r.prototype.mouseup,e.exports=r},{"../../util/vec2":657,"../action":537,"./utils":562}],559:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r))return new r(t,e);this.editor=t,this.lassoHelper=new d("lasso"===e?0:1,t,"fragment"===e)}function o(t,e){var n=t.molecule,r=Object.assign({},e);return Object.entries(e.bonds).forEach(function(e){var o=c(e,2),i=o[0],a=o[1],s=n.bonds.get(i),u=n.bonds.get(a);g.mergeBondsParams(t,s,u)?(delete r.atoms[s.begin],delete r.atoms[s.end]):delete r.bonds[i]}),0===Object.keys(r.atoms).length&&0===Object.keys(r.bonds).length?null:r}function i(t){var e={};return e[t.map]=[t.id],e}function a(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&(t[n]?t[n]=s(t[n],e[n]):t[n]=e[n].slice());return t}function s(t,e){for(var n=0;n<e.length;n++)t.indexOf(e[n])<0&&t.push(e[n]);return t}function u(t,e,n){if(!e)return!1;var r=t.ctab;if("frags"===n.map||"rgroups"===n.map){var o="frags"===n.map?r.frags.get(n.id).fragGetAtoms(t,n.id):r.rgroups.get(n.id).getAtoms(t);return!!e.atoms&&l.subset(l.fromList(o),l.fromList(e.atoms))}return!!e[n.map]&&e[n.map].indexOf(n.id)>-1}var c=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=t("../../util/set"),f=t("../action"),p=t("../../chem/struct"),d=t("./helper/lasso"),h=t("./sgroup"),m=t("./atom"),g=t("./utils");r.prototype.mousedown=function(t){var e=this.editor.render,n=e.ctab,r=n.molecule;this.editor.hover(null);var o=this.lassoHelper.fragment||t.ctrlKey,s=this.editor.findItem(t,o?["frags","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"]:["atoms","bonds","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"]);if(this.dragCtx={item:s,xy0:e.page2obj(t)},!s)return m.atomLongtapEvent(this,e),delete this.dragCtx.item,this.lassoHelper.fragment||this.lassoHelper.begin(t),!0;if(this.editor.hover(null),!u(e,this.editor.selection(),s)){var c=i(s);if("frags"===s.map){var l=n.frags.get(s.id);c={atoms:l.fragGetAtoms(e,s.id),bonds:l.fragGetBonds(e,s.id)}}else if("sgroups"===s.map){var f=n.sgroups.get(s.id).item;c={atoms:p.SGroup.getAtoms(r,f),bonds:p.SGroup.getBonds(r,f)}}else if("rgroups"===s.map){var d=n.rgroups.get(s.id);c={atoms:d.getAtoms(e),bonds:d.getBonds(e)}}this.editor.selection(t.shiftKey?a(c,this.editor.selection()):c)}return"atoms"===s.map&&m.atomLongtapEvent(this,e),!0},r.prototype.mousemove=function(t){var e=this.editor.render,n=e.ctab;if(this.dragCtx&&this.dragCtx.stopTapping&&this.dragCtx.stopTapping(),this.dragCtx&&this.dragCtx.item){this.dragCtx.action&&(this.dragCtx.action.perform(n),this.editor.update(this.dragCtx.action,!0));var r=this.editor.explicitSelected();if(this.dragCtx.action=f.fromMultipleMove(n,r,e.page2obj(t).sub(this.dragCtx.xy0)),this.dragCtx.mergeItems=o(n,this.editor.findMerge(r,["atoms","bonds"])),this.dragCtx.mergeItems){var i={atoms:Object.values(this.dragCtx.mergeItems.atoms),bonds:Object.values(this.dragCtx.mergeItems.bonds)};this.editor.hover({map:"merge",id:+Date.now(),items:i})}else this.editor.hover(null);return this.editor.update(this.dragCtx.action,!0),!0}if(this.lassoHelper.running()){var s=this.lassoHelper.addPoint(t);return this.editor.selection(t.shiftKey?a(s,this.editor.selection()):s),!0}var u=this.lassoHelper.fragment||t.ctrlKey?["frags","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"]:["atoms","bonds","sgroups","sgroupData","rgroups","rxnArrows","rxnPluses","chiralFlags"];return this.editor.hover(this.editor.findItem(t,u)),!0},r.prototype.mouseup=function(t){var e=this;if(this.dragCtx&&this.dragCtx.stopTapping&&this.dragCtx.stopTapping(),this.dragCtx&&this.dragCtx.item){var n=this.editor.render.ctab;this.dragCtx.mergeItems&&(this.editor.selection(null),Object.entries(this.dragCtx.mergeItems.atoms).forEach(function(t){e.dragCtx.action=e.dragCtx.action?f.fromAtomMerge(n,+t[0],+t[1]).mergeWith(e.dragCtx.action):f.fromAtomMerge(n,+t[0],+t[1])}),this.dragCtx.action=this.dragCtx.action?f.fromBondsMerge(n,this.dragCtx.mergeItems.bonds).mergeWith(this.dragCtx.action):f.fromBondsMerge(n,this.dragCtx.mergeItems.bonds)),this.editor.hover(null),this.dragCtx.action&&this.editor.update(this.dragCtx.action),delete this.dragCtx}else if(this.lassoHelper.running()){var r=this.lassoHelper.end();this.editor.selection(t.shiftKey?a(r,this.editor.selection()):r)}else this.lassoHelper.fragment&&this.editor.selection(null);return!0},r.prototype.dblclick=function(t){var e=this.editor,n=this.editor.render,r=this.editor.findItem(t,["atoms","bonds","sgroups","sgroupData"]);if(r){var o=n.ctab.molecule;if("atoms"===r.map){this.editor.selection(i(r));var a=o.atoms.get(r.id),s=e.event.elementEdit.dispatch(a);Promise.resolve(s).then(function(t){e.update(f.fromAtomsAttrs(n.ctab,r.id,t))})}else if("bonds"===r.map){this.editor.selection(i(r));var u=n.ctab.bonds.get(r.id).b,c=e.event.bondEdit.dispatch(u);Promise.resolve(c).then(function(t){e.update(f.fromBondAttrs(n.ctab,r.id,t))})}else"sgroups"!==r.map&&"sgroupData"!==r.map||(this.editor.selection(i(r)),h.dialog(this.editor,r.id));return!0}},r.prototype.cancel=r.prototype.mouseleave=function(){if(this.dragCtx&&this.dragCtx.stopTapping&&this.dragCtx.stopTapping(),this.dragCtx&&this.dragCtx.action){var t=this.dragCtx.action;this.editor.update(t)}this.lassoHelper.running()&&this.editor.selection(this.lassoHelper.end()),delete this.dragCtx,this.editor.hover(null)},e.exports=r},{"../../chem/struct":533,"../../util/set":656,"../action":537,"./atom":542,"./helper/lasso":549,"./sgroup":560,"./utils":562}],560:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r)){var n=t.selection()||{};if(!n.atoms&&!n.bonds)return new r(t,e);var i=t.render.ctab.molecule.sgroups,a=t.selection().atoms,s=i.find(function(t,e){return g(e.atoms,a)});return o(t,void 0!==s?s:null,e),t.selection(null),null}this.editor=t,this.type=e,this.lassoHelper=new b(1,t),this.editor.selection(null)}function o(t,e,n){var r=t.render.ctab,o=r.molecule,u=t.selection()||{},c=null!==e?o.sgroups.get(e):null,l=c?c.type:n,f="DAT"===l?"sdataEdit":"sgroupEdit";if(!u.atoms&&!u.bonds&&!c)return void console.info("There is no selection or sgroup");var p=null;c?(p=c.getAttrs(),p.context=i(r,c.atoms)):p={context:a(r,u)};var d=t.event[f].dispatch({type:l,attrs:p});Promise.resolve(d).then(function(n){if("DAT"!==n.type&&m(o,u.atoms||[]))t.event.message.dispatch({error:"Partial S-group overlapping is not allowed."});else{if(!(c||"DAT"===n.type||u.atoms&&0!==u.atoms.length))return;if(c&&c.getAttrs().context===n.attrs.context){var i=y.fromSeveralSgroupAddition(r,n.type,c.atoms,n.attrs).mergeWith(y.fromSgroupDeletion(r,e));return t.update(i),void t.selection(u)}var a=s(e,t,n,u);t.update(a.action),t.selection(a.selection)}}).catch(function(t){console.info("rejected",t)})}function i(t,e){var n=t.molecule;if(1===e.length)return w.Atom;if(p(t,e))return w.Multifragment;if(f(t,e))return w.Fragment;var r=e.reduce(function(t,e){return t[e]=!0,t},{});return l(n.bonds.values().filter(function(t){return r[t.begin]&&r[t.end]}))?w.Group:w.Bond}function a(t,e){var n=t.molecule;if(e.atoms&&!e.bonds)return w.Atom;var r=e.bonds.map(function(t){return n.bonds.get(t)});if(!l(r))return w.Bond;e.atoms=e.atoms||[];var o=c(e.atoms),i=r.every(function(t){return void 0!==o[t.begin]&&void 0!==o[t.end]});return f(t,e.atoms)&&i?w.Fragment:p(t,e.atoms)?w.Multifragment:w.Group}function s(t,e,n,r){var o=e.render.ctab,i=o.molecule.sgroups.get(t),a=i&&i.atoms||r.atoms||[],s=n.attrs.context,c=u(s,o,n,a,r);return c.selection=c.selection||r,null!==t&&void 0!==t&&(c.action=c.action.mergeWith(y.fromSgroupDeletion(o,t))),e.selection(c.selection),c}function u(t,e,n,r,o){if(t===w.Bond)return y.fromBondAction(e,n,r,o);var i=h(e.molecule,o.bonds),a=v(r.concat(i));return t===w.Fragment?y.fromGroupAction(e,n,a,e.atoms.keys()):t===w.Multifragment?y.fromMultiFragmentAction(e,n,a):t===w.Group?y.fromGroupAction(e,n,a,a):t===w.Atom?y.fromAtomAction(e,n,a):{action:y.fromSeveralSgroupAddition(e,n.type,r,n.attrs)}}function c(t){return t=t||[],t.reduce(function(t,e){return t[e]=e,t},{})}function l(t){if(0===t.length)return!0;for(var e=0;e<t.length;++e)for(var n=t[e],r=0;r<t.length;++r)if(e!==r){var o=t[r];if(n.end===o.begin||n.end===o.end)return!0}return!1}function f(t,e){return 1===d(t,e)}function p(t,e){return d(t,e)>1}function d(t,e){var n=c(e);return t.connectedComponents.values().reduce(function(t,e){return t+(0===Object.keys(e).reduce(function(t,e){return t+(void 0===n[e])},0)?1:0)},0)}function h(t,e){return e=e||[],e.reduce(function(e,n){var r=t.bonds.get(n);return e=e.concat([r.begin,r.end])},[])}function m(t,e){var n={},r={};return e.forEach(function(t){r[t]=!0}),0<=e.findIndex(function(o){var i=t.atoms.get(o);return 0<=x.list(i.sgs).findIndex(function(o){var i=t.sgroups.get(o);if("DAT"===i.type||o in n)return!1;var a=_.SGroup.getAtoms(t,i);return a.length<e.length&&0<=a.findIndex(function(t){return!(t in r)})||0<=e.findIndex(function(t){return-1===a.indexOf(t)})})})}var g=t("lodash/fp/isEqual"),v=t("lodash/fp/uniq"),b=t("./helper/lasso"),y=t("../action"),_=t("../../chem/struct"),x=t("../../util/set"),w=t("../../util/constants").SgContexts,S=["atoms","bonds","sgroups","sgroupData"];r.prototype.mousedown=function(t){this.editor.findItem(t,S)||this.lassoHelper.begin(t)},r.prototype.mousemove=function(t){this.lassoHelper.running(t)?this.editor.selection(this.lassoHelper.addPoint(t)):this.editor.hover(this.editor.findItem(t,S))},r.prototype.mouseleave=function(t){this.lassoHelper.running(t)&&this.lassoHelper.end(t)},r.prototype.mouseup=function(t){var e=null,n=null;if(this.lassoHelper.running(t))n=this.lassoHelper.end(t);else{var r=this.editor.findItem(t,S);if(!r)return;if(this.editor.hover(null),"atoms"===r.map)n={atoms:[r.id]};else if("bonds"===r.map){var i=this.editor.render.ctab.bonds.get(r.id);n={atoms:[i.b.begin,i.b.end]}}else{if("sgroups"!==r.map&&"sgroupData"!==r.map)return;e=r.id}}(null!==e||n&&n.atoms)&&o(this.editor,e,this.type)},e.exports=Object.assign(r,{dialog:o})},{"../../chem/struct":533,"../../util/constants":652,"../../util/set":656,"../action":537,"./helper/lasso":549,"lodash/fp/isEqual":431,"lodash/fp/uniq":438}],561:[function(t,e,n){"use strict";function r(t,e){if(!(this instanceof r))return new r(t,e);this.editor=t,this.editor.selection(null),this.template={aid:parseInt(e.aid)||0,bid:parseInt(e.bid)||0};var n=e.struct;n.rescale();var i=new a;n.atoms.each(function(t,e){i.add_(e.pp)}),this.template.molecule=n,this.findItems=[],this.template.xy0=i.scaled(1/(n.atoms.count()||1));var s=n.atoms.get(this.template.aid);s&&(this.template.angle0=u.calcAngle(s.pp,this.template.xy0),this.findItems.push("atoms"));var c=n.bonds.get(this.template.bid);c&&(this.template.sign=o(n,c,this.template.xy0),this.findItems.push("bonds"))}function o(t,e,n){var r=t.atoms.get(e.begin).pp,o=t.atoms.get(e.end).pp,i=a.cross(a.diff(r,o),a.diff(n,o));return i>0?1:i<0?-1:0}var i=t("../../util/set"),a=t("../../util/vec2"),s=t("../action"),u=t("./utils");r.prototype.mousedown=function(t){var e=this.editor,n=e.render;this.editor.hover(null),this.dragCtx={xy0:n.page2obj(t),item:e.findItem(t,this.findItems)};var r=this.dragCtx,s=r.item;if(s){if("bonds"===s.map){var u=n.ctab.molecule,c=new a,l=u.bonds.get(s.id),f=u.atoms.get(l.begin).fragment,p=u.getFragmentIds(f),d=0,h=u.halfBonds.get(l.hb1).loop;if(h<0&&(h=u.halfBonds.get(l.hb2).loop),h>=0){var m=u.loops.get(h).hbs;m.forEach(function(t){c.add_(u.atoms.get(u.halfBonds.get(t).begin).pp),d++})}else i.each(p,function(t){c.add_(u.atoms.get(t).pp),d++});r.v0=c.scaled(1/d);var g=o(u,l,r.v0);r.sign1=g||1,r.sign2=this.template.sign}}else delete r.item;return!0},r.prototype.mousemove=function(t){var e=this.editor,n=e.render;if(this.dragCtx){var r,i,c,l=this.dragCtx,f=l.item,p=n.page2obj(t);l.mouse_moved=!0;var d=n.ctab.molecule;if(f){if("atoms"===f.map)r=d.atoms.get(f.id).pp,c=a.dist(r,p)>1;else if("bonds"===f.map){var h=d.bonds.get(f.id),m=o(d,h,p);return l.sign1*this.template.sign>0&&(m=-m),m==l.sign2&&l.action||("action"in l&&l.action.perform(n.ctab),l.sign2=m,l.action=s.fromTemplateOnBond(n.ctab,f.id,this.template,l.sign1*l.sign2>0),this.editor.update(l.action,!0)),!0}}else r=l.xy0;i=u.calcAngle(r,p),t.ctrlKey||(i=u.fracAngle(i));var g=u.degrees(i);return!(!l.hasOwnProperty("angle")||l.angle!==g||l.hasOwnProperty("extra_bond")&&l.extra_bond!==c)||(l.action&&l.action.perform(n.ctab),l.angle=g,f?"atoms"===f.map&&(l.action=s.fromTemplateOnAtom(n.ctab,f.id,i,c,this.template),l.extra_bond=c):l.action=s.fromTemplateOnCanvas(n.ctab,r,i,this.template),this.editor.update(l.action,!0),!0)}return this.editor.hover(this.editor.findItem(t,this.findItems)),!0},r.prototype.mouseup=function(t){var e=this.editor,n=e.render;if(this.dragCtx){var r=this.dragCtx,o=r.item,i=n.ctab,a=i.molecule;if(!r.action){if(o)if("atoms"===o.map){var c=i.atoms.get(o.id).a.neighbors.length;if(c>1)r.action=s.fromTemplateOnAtom(i,o.id,null,!0,this.template);else if(1==c){var l=a.halfBonds.get(a.atoms.get(o.id).neighbors[0]).end,f=a.atoms.get(o.id),p=a.atoms.get(l),d=u.calcAngle(p.pp,f.pp);r.action=s.fromTemplateOnAtom(i,o.id,t.ctrlKey?d:u.fracAngle(d),!1,this.template)}else r.action=s.fromTemplateOnAtom(i,o.id,0,!1,this.template)}else"bonds"===o.map&&(r.action=s.fromTemplateOnBond(i,o.id,this.template,r.sign1*r.sign2>0));else r.action=s.fromTemplateOnCanvas(n.ctab,r.xy0,0,this.template);this.editor.update(r.action,!0)}var h=this.dragCtx.action;delete this.dragCtx,h&&!h.isDummy()&&this.editor.update(h)}},r.prototype.cancel=r.prototype.mouseleave=r.prototype.mouseup,e.exports=r},{"../../util/set":656,"../../util/vec2":657,"../action":537,"./utils":562}],562:[function(t,e,n){"use strict";function r(t){f=Math.PI/180*t}function o(t,e){var n=c.diff(e,t);return Math.atan2(n.y,n.x)}function i(t){return arguments.length>1&&(t=o(arguments[0],arguments[1])),Math.round(t/f)*f}function a(t,e){var n=new c(1,0).rotate(i(t,e));return n.add_(t),n}function s(t){return Math.round(t/Math.PI*180)}function u(t,e,n){var r=t.molecule.atoms,i=r.get(e.begin),a=r.get(n.begin),u=r.get(e.end),f=r.get(n.end),h=s(o(i.pp,u.pp)-o(a.pp,f.pp)),m=Math.abs(h%180),g=c.dist(i.pp,u.pp)/c.dist(a.pp,f.pp);return l(m,p,180-p)||!l(g,1-d,1+d)?null:{angle:m,scale:g,cross:Math.abs(h)>90}}var c=t("../../util/vec2"),l=t("lodash").inRange,f=Math.PI/12,p=10,d=.2;e.exports={calcAngle:o,fracAngle:i,calcNewAtomPos:a,degrees:s,setFracAngle:r,mergeBondsParams:u}},{"../../util/vec2":657,lodash:460}],563:[function(t,e,n){(function(n){"use strict";var r="undefined"!=typeof window?window.Raphael:void 0!==n?n.Raphael:null,o=t("./util/vec2");r.el.translateAbs=function(t,e){this.delta=this.delta||new o,this.delta.x+=t-0,this.delta.y+=e-0,this.transform("t"+this.delta.x.toString()+","+this.delta.y.toString())},r.st.translateAbs=function(t,e){this.forEach(function(n){n.translateAbs(t,e)})},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./util/vec2":657}],564:[function(t,e,n){"use strict";function r(t,e,n,r){return t.path("M{0},{1}L{2},{3}L{4},{5}M{2},{3}L{4},{6}",R(e.x),R(e.y),R(n.x),R(n.y),R(n.x-7),R(n.y-5),R(n.y+5)).attr(r.lineattr)}function o(t,e,n){var r=n.scale/5;return t.path("M{0},{4}L{0},{5}M{2},{1}L{3},{1}",R(e.x),R(e.y),R(e.x-r),R(e.x+r),R(e.y-r),R(e.y+r)).attr(n.lineattr)}function i(t,e,n,r){var o=e.p,i=n.p;return t.path(O(o,i)).attr(r.lineattr)}function a(t,e,n,r,o){return t.path("M{0},{1}L{2},{3}L{4},{5}Z",R(e.x),R(e.y),R(n.x),R(n.y),R(r.x),R(r.y)).attr(o.lineattr).attr({fill:"#000"})}function s(t,e,n,r,o,i){return t.path("M{0},{1}L{2},{3}L{4},{5}L{6},{7}Z",R(e.x),R(e.y),R(n.x),R(n.y),R(r.x),R(r.y),R(o.x),R(o.y)).attr(i.lineattr).attr({stroke:"#000",fill:"#000"})}function u(t,e,n,r,o){return t.set([e,t.path("M{0},{1}L{2},{3}",R(n.x),R(n.y),R(r.x),R(r.y)).attr(o.lineattr)])}function c(t,e,n,r,o,i){for(var a,s,u,c=e.p,l=e.norm,f=.7*i.stereoBond,p="",d=0;d<r;++d)u=c.addScaled(n,o*d),a=u.addScaled(l,f*(d+.5)/(r-.5)),s=u.addScaled(l,-f*(d+.5)/(r-.5)),p+=O(a,s);return t.path(p).attr(i.lineattr)}function l(t,e,n,r,o,i){for(var a=e.p,s=e.norm,u=.7*i.stereoBond,c="M"+R(a.x)+","+R(a.y),l=a,f=0;f<r;++f)l=a.addScaled(n,o*(f+.5)).addScaled(s,(1&f?-1:1)*u*(f+.5)/(r-.5)),c+="L"+R(l.x)+","+R(l.y);return t.path(c).attr(i.lineattr)}function f(t,e,n,r,o,i,a){return t.path(i?"M{0},{1}L{6},{7}M{4},{5}L{2},{3}":"M{0},{1}L{2},{3}M{4},{5}L{6},{7}",R(e.x),R(e.y),R(r.x),R(r.y),R(n.x),R(n.y),R(o.x),R(o.y)).attr(a.lineattr)}function p(t,e,n,r,o){for(var i,a=e.p,s=n.p,u=e.norm,c=o.bondSpace/2,l="",f=a,p=1;p<=r;++p)i=T.lc2(a,(r-p)/r,s,p/r),1&p?l+=O(f,i):(l+=O(f.addScaled(u,c),i.addScaled(u,c)),l+=O(f.addScaled(u,-c),i.addScaled(u,-c))),f=i;return t.path(l).attr(o.lineattr)}function d(t,e,n,r){var o=e.p,i=n.p,a=e.norm,s=o.addScaled(a,r.bondSpace),u=i.addScaled(a,r.bondSpace),c=o.addScaled(a,-r.bondSpace),l=i.addScaled(a,-r.bondSpace);return t.path(O(o,i)+O(s,u)+O(c,l)).attr(r.lineattr)}function h(t,e,n,r){var o=t.path(e[0]).attr(r.lineattr),i=t.path(e[1]).attr(r.lineattr);return void 0!==n&&null!==n&&(n>0?o:i).attr({"stroke-dasharray":"- "}),t.set([o,i])}function m(t,e,n,r){var o=e.p,i=n.p;return t.path(O(o,i)).attr(r.lineattr).attr({"stroke-dasharray":"- "})}function g(t,e,n){for(var r="",o=0;o<e.length/2;++o)r+=O(e[2*o],e[2*o+1]);return t.path(r).attr(n.lineattr)}function v(t,e,n,r){var o=t.text(e.x,e.y,n).attr({font:r.font,"font-size":r.fontszsub,fill:"#000"});return j(o,P.relBox(o.getBBox())),o}function b(t,e,n){var r=.9*n.lineWidth,o=r,i=2*r;return t.path("M{0},{1}L{2},{3}L{4},{5}",R(e.x-o),R(e.y+i),R(e.x),R(e.y),R(e.x+o),R(e.y+i)).attr({stroke:"#000","stroke-width":.7*n.lineWidth,"stroke-linecap":"square","stroke-linejoin":"miter"})}function y(t,e,n){return t.circle(R(e.x),R(e.y),n.lineWidth).attr({stroke:null,fill:"#000"})}function _(t,e,n,r,o,i,a){o=o||.25,i=i||1;var s=r.addScaled(n,-.5*i),u=r.addScaled(n,.5*i),c=s.addScaled(e,-o),l=u.addScaled(e,-o);return t.path("M{0},{1}L{2},{3}L{4},{5}L{6},{7}",R(c.x),R(c.y),R(s.x),R(s.y),R(u.x),R(u.y),R(l.x),R(l.y)).attr(a.sgroupBracketStyle)}function x(t,e,n,r){return t.rect(R(Math.min(e.x,n.x)),R(Math.min(e.y,n.y)),R(Math.abs(n.x-e.x)),R(Math.abs(n.y-e.y))).attr(r.lassoStyle)}function w(t,e,n){for(var r=e[e.length-1],o="M"+R(r.x)+","+R(r.y),i=0;i<e.length;++i)o+="L"+R(e[i].x)+","+R(e[i].y);return t.path(o).attr(n.lassoStyle)}function S(t,e,n,r){return t.path(O(e,n)).attr(r.lassoStyle)}function O(t,e){return"M"+R(t.x)+","+R(t.y)+"L"+R(e.x)+","+R(e.y)+"\t"}function A(t,e,n){for(var r=0,o=T.dist(t,e),i=T.diff(e,t).normalized(),a=!0,s="",u=0;r<o;){var c=n[u%n.length],l=r+Math.min(c,o-r);a&&(s+="M "+t.addScaled(i,r).coordStr()+" L "+t.addScaled(i,l).coordStr()),r+=c,a=!a,u++}return s}function E(t,e,n,r,o,i){return[i&&1&o?A(t,n,i):O(t,n),i&&2&o?A(e,r,i):O(e,r)]}function j(t,e){if(C.vml){console.assert(null,"Souldn't go here!");var n=.16*e.height;t.translateAbs(0,n),e.y+=n}}var P=t("./util"),T=t("../util/vec2"),C=t("../raphael-ext"),R=P.tfx;e.exports={recenterText:j,arrow:r,plus:o,aromaticBondPaths:E,bondSingle:i,bondSingleUp:a,bondSingleStereoBold:s,bondDoubleStereoBold:u,bondSingleDown:c,bondSingleEither:l,bondDouble:f,bondSingleOrDouble:p,bondTriple:d,bondAromatic:h,bondAny:m,reactingCenter:g,topologyMark:v,radicalCap:b,radicalBullet:y,bracket:_,selectionRectangle:x,selectionPolygon:w,selectionLine:S}},{"../raphael-ext":563,"../util/vec2":657,"./util":580}],565:[function(t,e,n){"use strict";function r(t,e){var n=t.clientWidth-10,r=t.clientHeight-10;n=n>0?n:0,r=r>0?r:0,this.userOpts=e,this.clientArea=t,this.paper=new a(t,n,r),this.sz=u.ZERO,this.ctab=new f(new l,this),this.options=p(this.userOpts)}function o(t){var e=0,n=0;if(t.parentNode)do{e+=t.offsetTop||0,n+=t.offsetLeft||0,t=t.offsetParent}while(t);return{left:n,top:e}}function i(t,e,n,r,o){var i=e<0?-e:0,a=n<0?-n:0;return t.x<r&&(i+=r-t.x),t.y<o&&(a+=o-t.y),new u(i,a)}var a=t("../raphael-ext"),s=t("../util/box2abs"),u=t("../util/vec2"),c=t("../util/scale"),l=t("../chem/struct"),f=t("./restruct"),p=t("./options"),d={debug:!1,logcnt:0,logmouse:!1,hl:!1};d.logMethod=function(){},r.prototype.view2obj=function(t,e){var n=this.scrollPos();return this.useOldZoom||(t=t.scaled(1/this.options.zoom),n=n.scaled(1/this.options.zoom)),t=e?t:t.add(n).sub(this.options.offset),c.scaled2obj(t,this.options)},r.prototype.obj2view=function(t,e){var n=c.obj2scaled(t,this.options);return n=e?n:n.add(this.options.offset).sub(this.scrollPos().scaled(1/this.options.zoom)),this.useOldZoom||(n=n.scaled(this.options.zoom)),n},r.prototype.scrollPos=function(){return new u(this.clientArea.scrollLeft,this.clientArea.scrollTop)},r.prototype.page2obj=function(t){var e=o(this.clientArea),n=new u(t.pageX-e.left,t.pageY-e.top);return this.view2obj(n)},r.prototype.setPaperSize=function(t){d.logMethod("setPaperSize"),this.sz=t,this.paper.setSize(t.x*this.options.zoom,t.y*this.options.zoom),this.setViewBox(this.options.zoom)},r.prototype.setOffset=function(t){d.logMethod("setOffset");var e=new u(t.x-this.options.offset.x,t.y-this.options.offset.y);this.clientArea.scrollLeft+=e.x,this.clientArea.scrollTop+=e.y,this.options.offset=t},r.prototype.setZoom=function(t){console.info("set zoom",t),this.options.zoom=t,this.paper.setSize(this.sz.x*t,this.sz.y*t),this.setViewBox(t)},r.prototype.setScrollOffset=function(t,e){var n=this.clientArea,r=n.clientWidth,o=n.clientHeight,a=i(this.sz.scaled(this.options.zoom),t,e,r+t,o+e).scaled(1/this.options.zoom);if(a.x>0||a.y>0){this.setPaperSize(this.sz.add(a));var s=new u(t<0?-t:0,e<0?-e:0).scaled(1/this.options.zoom);(s.x>0||s.y>0)&&(this.ctab.translate(s),this.setOffset(this.options.offset.add(s)))}n.scrollLeft=t,n.scrollTop=e,this.update(!1)},r.prototype.setScale=function(t){this.options.offset&&(this.options.offset=this.options.offset.scaled(1/t).scaled(t)),this.userOpts.scale*=t,this.options=null,this.update(!0)},r.prototype.setViewBox=function(t){this.useOldZoom?this.setScale(t):this.paper.canvas.setAttribute("viewBox","0 0 "+this.sz.x+" "+this.sz.y)},r.prototype.setMolecule=function(t){d.logMethod("setMolecule"),this.paper.clear(),this.ctab=new f(t,this),this.options.offset=new u,this.update(!1)},r.prototype.update=function(t,e){e=e||new u(this.clientArea.clientWidth||100,this.clientArea.clientHeight||100);var n=this.ctab.update(t);if(this.ctab.setSelection(),n){var r=this.options.scale,o=this.ctab.getVBoxObj().transform(c.obj2scaled,this.options).translate(this.options.offset||new u);if(this.options.autoScale){var i=o.sz(),a=this.options.autoScaleMargin,l=new u(a,a),f=e;if(f.x<2*a+1||f.y<2*a+1)throw new Error("View box too small for the given margin");var p=Math.max(i.x/(f.x-2*a),i.y/(f.y-2*a));this.options.maxBondLength/p>1&&(p=1);var d=i.add(l.scaled(2*p));this.paper.setViewBox(o.pos().x-a*p-(f.x*p-d.x)/2,o.pos().y-a*p-(f.y*p-d.y)/2,f.x*p,f.y*p)}else{var h=u.UNIT.scaled(r),m=o.sz().length()>0?o.extend(h,h):o,g=new s(this.scrollPos(),e.scaled(1/this.options.zoom).sub(u.UNIT.scaled(20))),v=s.union(g,m);this.oldCb||(this.oldCb=new s);var b=v.sz().floor(),y=this.oldCb.p0.sub(v.p0).ceil();this.oldBb=o,this.sz&&b.x==this.sz.x&&b.y==this.sz.y||this.setPaperSize(b),this.options.offset=this.options.offset||new u,0==y.x&&0==y.y||(this.setOffset(this.options.offset.add(y)),this.ctab.translate(y))}}},e.exports=r},{"../chem/struct":533,"../raphael-ext":563,"../util/box2abs":651,"../util/scale":655,"../util/vec2":657,"./options":566,"./restruct":567}],566:[function(t,e,n){"use strict";function r(t){var e=t.scale||100;t.rotationStep&&o.setFracAngle(t.rotationStep);var n=Math.ceil(e/6*1.9),r=Math.ceil(.7*n),a={showAtomIds:!1,showBondIds:!1,showHalfBondIds:!1,showLoopIds:!1,hideChiralFlag:!1,showValenceWarnings:!0,autoScale:!1,autoScaleMargin:0,maxBondLength:0,atomColoring:!0,hideImplicitHydrogen:!1,hideTerminalLabels:!1,carbonExplicitly:!1,showCharge:!0,showHydrogenLabels:"on",showValence:!0,aromaticCircle:!0,scale:e,zoom:1,offset:new i,lineWidth:e/20,bondSpace:t.doubleBondWidth||e/7,stereoBond:t.stereoBondWidth||e/7,subFontSize:r,font:"30px Arial",fontsz:n,fontszsub:r,fontRLabel:1.2*n,fontRLogic:.7*n,lineattr:{stroke:"#000","stroke-width":t.bondThickness||e/20,"stroke-linecap":"round","stroke-linejoin":"round"},selectionStyle:{fill:"#7f7",stroke:"none"},highlightStyle:{stroke:"#0c0","stroke-width":.6*e/20},sgroupBracketStyle:{stroke:"darkgray","stroke-width":.5*e/20},lassoStyle:{stroke:"gray","stroke-width":"1px"},atomSelectionPlateRadius:1.2*n};return Object.assign({},a,t)}var o=t("../editor/tool/utils"),i=t("../util/vec2");e.exports=r},{"../editor/tool/utils":562,"../util/vec2":657}],567:[function(t,e,n){"use strict";function r(t,e){this.render=e,this.atoms=new u,this.bonds=new u,this.reloops=new u,this.rxnPluses=new u,this.rxnArrows=new u,this.frags=new u,this.rgroups=new u,this.sgroups=new u,this.sgroupData=new u,this.chiralFlags=new u,this.molecule=t||new h,this.initialized=!1,this.layers=[],this.initLayers(),this.connectedComponents=new c,this.ccFragmentType=new u;for(var n in r.maps)this[n+"Changed"]={};if(this.structChanged=!1,t.atoms.each(function(t,e){this.atoms.set(t,new m(e))},this),t.bonds.each(function(t,e){this.bonds.set(t,new g(e))},this),t.loops.each(function(t,e){this.reloops.set(t,new O(e))},this),t.rxnPluses.each(function(t,e){this.rxnPluses.set(t,new v(e))},this),t.rxnArrows.each(function(t,e){this.rxnArrows.set(t,new b(e))},this),t.frags.each(function(t,e){this.frags.set(t,new y(e))},this),t.rgroups.each(function(t,e){this.rgroups.set(t,new _(e))},this),t.sgroups.each(function(t,e){this.sgroups.set(t,new S(e)),"DAT"!==e.type||e.data.attached||this.sgroupData.set(t,new x(e))},this),t.isChiral){var o=t.getCoordBoundingBox();this.chiralFlags.set(0,new w(new f(o.max.x,o.min.y-1)))}}function o(t){if(t)for(var e in r.maps)if(r.maps.hasOwnProperty(e)&&t[e]&&t[e].length>0)return!1;return!0}function i(t,e){if("set"==t.type)for(var n=0;n<t.length;++n)i(t[n],e);else void 0!==t.attrs&&("font-size"in t.attrs?t.attr("font-size",t.attrs["font-size"]*e):"stroke-width"in t.attrs&&t.attr("stroke-width",t.attrs["stroke-width"]*e)),t.scale(e,e,0,0)}function a(t,e){for(var n=0;n<t.paths.length;++n)i(t.paths[n],e)}var s=t("../../util/box2abs"),u=t("../../util/map"),c=t("../../util/pool"),l=t("../../util/set"),f=t("../../util/vec2"),p=t("../../util/scale"),d=t("../util"),h=t("../../chem/struct"),m=t("./reatom"),g=t("./rebond"),v=t("./rerxnplus"),b=t("./rerxnarrow"),y=t("./refrag"),_=t("./rergroup"),x=t("./redatasgroupdata"),w=t("./rechiralflag"),S=t("./resgroup"),O=t("./reloop"),A={background:0,selectionPlate:1,highlighting:2,warnings:3,data:4,indices:5};r.prototype.connectedComponentRemoveAtom=function(t,e){if(e=e||this.atoms.get(t),!(e.component<0)){var n=this.connectedComponents.get(e.component);l.remove(n,t),l.size(n)<1&&this.connectedComponents.remove(e.component),e.component=-1}},r.prototype.clearConnectedComponents=function(){this.connectedComponents.clear(),this.atoms.each(function(t,e){e.component=-1})},r.prototype.getConnectedComponent=function(t,e){for(var n="number"==typeof t.length?[].slice.call(t):[t],r=l.empty();n.length>0;)(function(){var t=n.pop();l.add(r,t);var o=this.atoms.get(t);o.component>=0&&l.add(e,o.component);for(var i=0;i<o.a.neighbors.length;++i){var a=this.molecule.halfBonds.get(o.a.neighbors[i]).end;l.contains(r,a)||n.push(a)}}).apply(this);return r},r.prototype.addConnectedComponent=function(t){var e=this.connectedComponents.add(t),n=l.empty(),r=this.getConnectedComponent(l.list(t),n);l.remove(n,e);var o=-1;return l.each(r,function(t){var n=this.atoms.get(t);if(n.component=e,-1!=n.a.rxnFragmentType){if(-1!=o&&n.a.rxnFragmentType!=o)throw new Error("reaction fragment type mismatch");o=n.a.rxnFragmentType}},this),this.ccFragmentType.set(e,o),e},r.prototype.removeConnectedComponent=function(t){return l.each(this.connectedComponents.get(t),function(t){this.atoms.get(t).component=-1},this),this.connectedComponents.remove(t)},r.prototype.connectedComponentMergeIn=function(t,e){l.each(e,function(e){this.atoms.get(e).component=t},this),l.mergeIn(this.connectedComponents.get(t),e)},r.prototype.assignConnectedComponents=function(){this.atoms.each(function(t,e){if(!(e.component>=0)){var n=l.empty(),r=this.getConnectedComponent(t,n);l.each(n,function(t){this.removeConnectedComponent(t)},this),this.addConnectedComponent(r)}},this)},r.prototype.connectedComponentGetBoundingBox=function(t,e,n){return e=e||this.connectedComponents.get(t),n=n||{min:null,max:null},l.each(e,function(t){var e=p.obj2scaled(this.atoms.get(t).a.pp,this.render.options);null==n.min?n.min=n.max=e:(n.min=n.min.min(e),n.max=n.max.max(e))},this),n},r.prototype.initLayers=function(){for(var t in A)this.layers[A[t]]=this.render.paper.rect(0,0,10,10).attr({class:t+"Layer",fill:"#000",opacity:"0.0"}).toFront()},r.prototype.addReObjectPath=function(t,e,n,r,o){if(n&&this.layers[A[t]].node.parentNode){var i=this.render.options.offset,a=o?s.fromRelBox(d.relBox(n.getBBox())):null,u=r&&a?a.translate(r.negated()):null;null!==i&&(n.translateAbs(i.x,i.y),a=a?a.translate(i):null),e.add(n,a,u),n.insertBefore(this.layers[A[t]])}},r.prototype.clearMarks=function(){for(var t in r.maps)this[t+"Changed"]={};this.structChanged=!1},r.prototype.markItemRemoved=function(){this.structChanged=!0},r.prototype.markBond=function(t,e){this.markItem("bonds",t,e)},r.prototype.markAtom=function(t,e){this.markItem("atoms",t,e)},r.prototype.markItem=function(t,e,n){var r=this[t+"Changed"];r[e]=void 0!==r[e]?Math.max(n,r[e]):n,this[t].has(e)&&this.clearVisel(this[t].get(e).visel)},r.prototype.clearVisel=function(t){for(var e=0;e<t.paths.length;++e)t.paths[e].remove();t.clear()},r.prototype.eachItem=function(t,e){for(var n in r.maps)this[n].each(function(n,r){t.call(e,r)})},r.prototype.getVBoxObj=function(t){if(t=t||{},o(t))for(var e in r.maps)r.maps.hasOwnProperty(e)&&(t[e]=this[e].keys());var n=null;for(e in r.maps)r.maps.hasOwnProperty(e)&&t[e]&&t[e].forEach(function(t){var r=this[e].get(t).getVBoxObj(this.render);r&&(n=n?s.union(n,r):r.clone())},this);return n=n||new s(0,0,0,0)},r.prototype.translate=function(t){this.eachItem(function(e){e.visel.translate(t)})},r.prototype.scale=function(t){this.eachItem(function(e){a(e.visel,t)})},r.prototype.clearVisels=function(){this.eachItem(function(t){this.clearVisel(t.visel)},this)},r.prototype.update=function(t){t=t||!this.initialized;var e,n,o;if(t)for(n in r.maps)r.maps.hasOwnProperty(n)&&(o=this[n+"Changed"],this[n].each(function(t){o[t]=1},this));else for(n in r.maps)if(r.maps.hasOwnProperty(n)){o=this[n+"Changed"];for(e in o)this[n].has(e)||delete o[e]}for(e in this.atomsChanged)this.connectedComponentRemoveAtom(e);for(var i=this.frags.findAll(function(t,e){return!e.calcBBox(this.render.ctab,t,this.render)},this),a=0;a<i.length;++a){var s=i[a]
;this.clearVisel(this.frags.get(s).visel),this.frags.unset(s),this.molecule.frags.remove(s)}for(n in r.maps){o=this[n+"Changed"];for(e in o)this.clearVisel(this[n].get(e).visel),this.structChanged|=o[e]>0}this.sgroups.each(function(t,e){this.clearVisel(e.visel),e.highlighting=null,e.selectionPlate=null},this),this.frags.each(function(t,e){this.clearVisel(e.visel)},this),this.rgroups.each(function(t,e){this.clearVisel(e.visel)},this),t&&(this.clearConnectedComponents(),this.molecule.initHalfBonds(),this.molecule.initNeighbors()),this.molecule.updateHalfBonds(new u(this.atomsChanged).findAll(function(t,e){return e>=0},this)),this.molecule.sortNeighbors(new u(this.atomsChanged).findAll(function(t,e){return e>=1},this)),this.assignConnectedComponents(),this.initialized=!0,this.verifyLoops();var c=t||this.structChanged;return c&&this.updateLoops(),this.setImplicitHydrogen(),this.showLabels(),this.showBonds(),c&&this.showLoops(),this.showReactionSymbols(),this.showSGroups(),this.showFragments(),this.showRGroups(),!0!==this.render.options.hideChiralFlag&&this.chiralFlags.each(function(t,e){e.show(this,t,this.render.options)},this),this.clearMarks(),!0},r.prototype.updateLoops=function(){this.reloops.each(function(t,e){this.clearVisel(e.visel)},this);var t=this.molecule.findLoops();t.bondsToMark.forEach(function(t){this.markBond(t,1)},this),t.newLoops.forEach(function(t){this.reloops.set(t,new O(this.molecule.loops.get(t)))},this)},r.prototype.showLoops=function(){var t=this.render.options;this.reloops.each(function(e,n){n.show(this,e,t)},this)},r.prototype.showReactionSymbols=function(){var t,e,n=this.render.options;for(e in this.rxnArrowsChanged)t=this.rxnArrows.get(e),t.show(this,e,n);for(e in this.rxnPlusesChanged)t=this.rxnPluses.get(e),t.show(this,e,n)},r.prototype.showSGroups=function(){var t=this.render.options;this.molecule.sGroupForest.getSGroupsBFS().reverse().forEach(function(e){this.sgroups.get(e).show(this,e,t)},this)},r.prototype.showFragments=function(){this.frags.each(function(t,e){var n=e.draw(this.render,t);n&&this.addReObjectPath("data",e.visel,n,null,!0)},this)},r.prototype.showRGroups=function(){var t=this.render.options;this.rgroups.each(function(e,n){n.show(this,e,t)},this)},r.prototype.eachCC=function(t,e,n){this.connectedComponents.each(function(r,o){e&&this.ccFragmentType.get(r)!=e||t.call(n||this,r,o)},this)},r.prototype.getGroupBB=function(t){var e={min:null,max:null};return this.eachCC(function(t,n){e=this.connectedComponentGetBoundingBox(t,n,e)},t,this),e},r.prototype.setImplicitHydrogen=function(){this.molecule.setImplicitHydrogen(Object.keys(this.atomsChanged))},r.prototype.loopRemove=function(t){if(this.reloops.has(t)){var e=this.reloops.get(t);this.clearVisel(e.visel);for(var n=[],r=0;r<e.loop.hbs.length;++r){var o=e.loop.hbs[r];if(this.molecule.halfBonds.has(o)){var i=this.molecule.halfBonds.get(o);i.loop=-1,this.markBond(i.bid,1),this.markAtom(i.begin,1),n.push(i.bid)}}this.reloops.unset(t),this.molecule.loops.remove(t)}},r.prototype.verifyLoops=function(){var t=[];this.reloops.each(function(e,n){n.isValid(this.molecule,e)||t.push(e)},this);for(var e=0;e<t.length;++e)this.loopRemove(t[e])},r.prototype.showLabels=function(){var t=this.render.options;for(var e in this.atomsChanged){this.atoms.get(e).show(this,e,t)}},r.prototype.showBonds=function(){var t=this.render.options;for(var e in this.bondsChanged){this.bonds.get(e).show(this,e,t)}},r.prototype.setSelection=function(t){var e=0===arguments.length;for(var n in r.maps)r.maps.hasOwnProperty(n)&&r.maps[n].isSelectable()&&this[n].each(function(r,o){var i=e?o.selected:t&&t[n]&&t[n].indexOf(r)>-1;this.showItemSelection(o,i)},this)},r.prototype.showItemSelection=function(t,e){var n=null!=t.selectionPlate&&!t.selectionPlate.removed;if(t.selected=e,t instanceof x&&(t.sgroup.selected=e),e){if(!n){var r=this.render,o=r.options,i=r.paper;t.selectionPlate=t.makeSelectionPlate(this,i,o),this.addReObjectPath("selectionPlate",t.visel,t.selectionPlate)}t.selectionPlate&&t.selectionPlate.show()}else n&&t.selectionPlate&&t.selectionPlate.hide()},r.maps={atoms:m,bonds:g,rxnPluses:v,rxnArrows:b,frags:y,rgroups:_,sgroupData:x,chiralFlags:w,sgroups:S,reloops:O},e.exports=Object.assign(r,{Atom:m,Bond:g,RxnPlus:v,RxnArrow:b,Frag:y,RGroup:_,ChiralFlag:w,SGroup:S})},{"../../chem/struct":533,"../../util/box2abs":651,"../../util/map":653,"../../util/pool":654,"../../util/scale":655,"../../util/set":656,"../../util/vec2":657,"../util":580,"./reatom":568,"./rebond":569,"./rechiralflag":570,"./redatasgroupdata":571,"./refrag":572,"./reloop":573,"./rergroup":575,"./rerxnarrow":576,"./rerxnplus":577,"./resgroup":578}],568:[function(t,e,n){"use strict";function r(t){this.init("atom"),this.a=t,this.showLabel=!1,this.hydrogenOnTheLeft=!1,this.color="#000000",this.component=-1}function o(t,e,n){var r="off"!==e.showHydrogenLabels&&"Hetero"!==e.showHydrogenLabels;if(0===n.a.neighbors.length||n.a.neighbors.length<2&&r||e.carbonExplicitly||"c"!==n.a.label.toLowerCase()||n.a.badConn&&e.showValenceWarnings||0!=n.a.isotope||0!=n.a.radical||0!=n.a.charge||n.a.explicitValence>=0||null!=n.a.atomList||null!=n.a.rglabel||n.a.alias)return!0;if(2==n.a.neighbors.length){var o=n.a.neighbors[0],i=n.a.neighbors[1],a=t.molecule.halfBonds.get(o),s=t.molecule.halfBonds.get(i),u=t.bonds.get(a.bid),c=t.bonds.get(s.bid);if(u.b.type==c.b.type&&u.b.stereo==P.Bond.PATTERN.STEREO.NONE&&c.b.stereo==P.Bond.PATTERN.STEREO.NONE&&Math.abs(j.cross(a.dir,s.dir))<.2)return!0}return!1}function i(t,e){return"on"===t||"Terminal"===t&&e.a.neighbors.length<2||"Hetero"===t&&"c"!==e.label.text.toLowerCase()||"Terminal and Hetero"===t&&(e.a.neighbors.length<2||"c"!==e.label.text.toLowerCase())}function a(t,e){if(0===e.a.neighbors.length){var n=O.map[e.a.label];return!n||!!O[n].leftH}for(var r=1,o=1,i=0,a=0,s=0;s<e.a.neighbors.length;++s){var u=t.halfBonds.get(e.a.neighbors[s]).dir;u.x<=0?(r=Math.min(r,Math.abs(u.y)),i++):(o=Math.min(o,Math.abs(u.y)),a++)}return r<.51||o<.51?o<r:a>i}function s(t,e,n,r){var o={};if(t.color="black",null!=t.a.atomList)o.text=t.a.atomList.label();else if(t.a.pseudo)o.text=t.a.pseudo;else if(t.a.alias)o.text=t.a.alias;else if("R#"===t.a.label&&null!=t.a.rglabel){o.text="";for(var i=0;i<32;i++)t.a.rglabel&1<<i&&(o.text+="R"+(i+1).toString());""==o.text&&(o="R#")}else{o.text=t.a.label;var a=O.map[o.text];r.atomColoring&&a&&(t.color=O[a].color||"#000")}return o.path=e.text(n.x,n.y,o.text).attr({font:r.font,"font-size":r.fontsz,fill:t.color,"font-style":t.a.pseudo?"italic":""}),o.rbb=E.relBox(o.path.getBBox()),A.recenterText(o.path,o.rbb),null!=t.a.atomList&&b(o.path,o.rbb,(t.hydrogenOnTheLeft?-1:1)*(o.rbb.width-o.rbb.height)/2,0),t.label=o,o}function u(t,e,n,r){var o=S.obj2scaled(t.a.pp,e.options),i=e.options,a=.5*i.lineWidth,s={};return s.text=(n+1).toString(),s.path=e.paper.text(o.x,o.y,s.text).attr({font:i.font,"font-size":i.fontszsub,fill:t.color}),s.rbb=E.relBox(s.path.getBBox()),A.recenterText(s.path,s.rbb),b(s.path,s.rbb,r+.5*s.rbb.width+a,.2*t.label.rbb.height),s}function c(t,e){var n,r=S.obj2scaled(t.a.pp,e.options),o=e.options,i=e.paper,a={};switch(t.a.radical){case 1:a.path=i.set(),n=1.6*o.lineWidth,a.path.push(A.radicalBullet(i,r.add(new j(-n,0)),o),A.radicalBullet(i,r.add(new j(n,0)),o)),a.path.attr("fill",t.color);break;case 2:a.path=i.set(),a.path.push(A.radicalBullet(i,r,o)),a.path.attr("fill",t.color);break;case 3:a.path=i.set(),n=1.6*o.lineWidth,a.path.push(A.radicalCap(i,r.add(new j(-n,0)),o),A.radicalCap(i,r.add(new j(n,0)),o)),a.path.attr("stroke",t.color)}a.rbb=E.relBox(a.path.getBBox());var s=-.5*(t.label.rbb.height+a.rbb.height);return 3===t.a.radical&&(s-=o.lineWidth/2),b(a.path,a.rbb,0,s),a}function l(t,e,n){var r=S.obj2scaled(t.a.pp,e.options),o=e.options,i=.5*o.lineWidth,a={};return a.text=t.a.isotope.toString(),a.path=e.paper.text(r.x,r.y,a.text).attr({font:o.font,"font-size":o.fontszsub,fill:t.color}),a.rbb=E.relBox(a.path.getBBox()),A.recenterText(a.path,a.rbb),b(a.path,a.rbb,n-.5*a.rbb.width-i,-.3*t.label.rbb.height),a}function f(t,e,n){var r=S.obj2scaled(t.a.pp,e.options),o=e.options,i=.5*o.lineWidth,a={};a.text="";var s=Math.abs(t.a.charge);return 1!=s&&(a.text=s.toString()),t.a.charge<0?a.text+="":a.text+="+",a.path=e.paper.text(r.x,r.y,a.text).attr({font:o.font,"font-size":o.fontszsub,fill:t.color}),a.rbb=E.relBox(a.path.getBBox()),A.recenterText(a.path,a.rbb),b(a.path,a.rbb,n+.5*a.rbb.width+i,-.3*t.label.rbb.height),a}function p(t,e,n){var r={0:"0",1:"I",2:"II",3:"III",4:"IV",5:"V",6:"VI",7:"VII",8:"VIII",9:"IX",10:"X",11:"XI",12:"XII",13:"XIII",14:"XIV"},o=S.obj2scaled(t.a.pp,e.options),i=e.options,a=.5*i.lineWidth,s={};if(s.text=r[t.a.explicitValence],!s.text)throw new Error("invalid valence "+t.a.explicitValence.toString());return s.text="("+s.text+")",s.path=e.paper.text(o.x,o.y,s.text).attr({font:i.font,"font-size":i.fontszsub,fill:t.color}),s.rbb=E.relBox(s.path.getBBox()),A.recenterText(s.path,s.rbb),b(s.path,s.rbb,n+.5*s.rbb.width+a,-.3*t.label.rbb.height),s}function d(t,e,n,r){var o=r.hydroIndex,i=t.hydrogenOnTheLeft,a=S.obj2scaled(t.a.pp,e.options),s=e.options,u=.5*s.lineWidth,c=r.hydrogen;return c.text="H",c.path=e.paper.text(a.x,a.y,c.text).attr({font:s.font,"font-size":s.fontsz,fill:t.color}),c.rbb=E.relBox(c.path.getBBox()),A.recenterText(c.path,c.rbb),i||(b(c.path,c.rbb,r.rightMargin+.5*c.rbb.width+u,0),r.rightMargin+=c.rbb.width+u),n>1&&(o={},o.text=n.toString(),o.path=e.paper.text(a.x,a.y,o.text).attr({font:s.font,"font-size":s.fontszsub,fill:t.color}),o.rbb=E.relBox(o.path.getBBox()),A.recenterText(o.path,o.rbb),i||(b(o.path,o.rbb,r.rightMargin+.5*o.rbb.width+u,.2*t.label.rbb.height),r.rightMargin+=o.rbb.width+u)),i&&(null!=o&&(b(o.path,o.rbb,r.leftMargin-.5*o.rbb.width-u,.2*t.label.rbb.height),r.leftMargin-=o.rbb.width+u),b(c.path,c.rbb,r.leftMargin-.5*c.rbb.width-u,0),r.leftMargin-=c.rbb.width+u),Object.assign(r,{hydrogen:c,hydroIndex:o})}function h(t,e,n,r){var o=S.obj2scaled(t.a.pp,e.options),i=.5*e.options.lineWidth,a=E.tfx,s={},u=o.y+t.label.rbb.height/2+i;return s.path=e.paper.path("M{0},{1}L{2},{3}",a(o.x+n),a(u),a(o.x+r),a(u)).attr(e.options.lineattr).attr({stroke:"#F00"}),s.rbb=E.relBox(s.path.getBBox()),s}function m(t,e,n,r){var o,i,a=S.obj2scaled(t.a.pp,e.options),s=e.options,u=E.tfx;for(o=0,0;o<4;++o){var c="";if(t.a.attpnt&1<<o){for(c.length>0&&(c+=" "),c+="",i=0;i<(0==o?0:o+1);++i)c+="'";var l=new j(a),f=a.addScaled(n,.7*s.scale),p=e.paper.text(f.x,f.y,c).attr({font:s.font,"font-size":s.fontsz,fill:t.color}),d=E.relBox(p.getBBox());A.recenterText(p,d);var h=n.negated();f=f.addScaled(h,j.shiftRayBox(f,h,x.fromRelBox(d))+s.lineWidth/2),l=_(t,l,n,s.lineWidth);var m=n.rotateSC(1,0),g=f.addScaled(m,.05*s.scale).addScaled(h,.09*s.scale),v=f.addScaled(m,-.05*s.scale).addScaled(h,.09*s.scale),b=e.paper.set();b.push(p,e.paper.path("M{0},{1}L{2},{3}M{4},{5}L{2},{3}L{6},{7}",u(l.x),u(l.y),u(f.x),u(f.y),u(g.x),u(g.y),u(v.x),u(v.y)).attr(e.options.lineattr).attr({"stroke-width":s.lineWidth/2})),r("indices",t.visel,b,a),n=n.rotate(Math.PI/6)}}}function g(t){var e="";if(t.a.aam>0&&(e+=t.a.aam),t.a.invRet>0)if(e.length>0&&(e+=","),1==t.a.invRet)e+="Inv";else{if(2!=t.a.invRet)throw new Error("Invalid value for the invert/retain flag");e+="Ret"}if(t.a.exactChangeFlag>0){if(e.length>0&&(e+=","),1!=t.a.exactChangeFlag)throw new Error("Invalid value for the exact change flag");e+="ext"}return e}function v(t){var e="";if(0!=t.a.ringBondCount)if(t.a.ringBondCount>0)e+="rb"+t.a.ringBondCount.toString();else if(-1==t.a.ringBondCount)e+="rb0";else{if(-2!=t.a.ringBondCount)throw new Error("Ring bond count invalid");e+="rb*"}if(0!=t.a.substitutionCount)if(e.length>0&&(e+=","),t.a.substitutionCount>0)e+="s"+t.a.substitutionCount.toString();else if(-1==t.a.substitutionCount)e+="s0";else{if(-2!=t.a.substitutionCount)throw new Error("Substitution count invalid");e+="s*"}if(t.a.unsaturatedAtom>0){if(e.length>0&&(e+=","),1!=t.a.unsaturatedAtom)throw new Error("Unsaturated atom invalid value");e+="u"}return t.a.hCount>0&&(e.length>0&&(e+=","),e+="H"+(t.a.hCount-1).toString()),e}function b(t,e,n,r){t.translateAbs(n,r),e.x+=n,e.y+=r}function y(t,e){var n=[];t.a.neighbors.forEach(function(t){var r=e.halfBonds.get(t);n.push(r.ang)}),n=n.sort(function(t,e){return t-e});for(var r=[],o=0;o<n.length-1;++o)r.push(n[(o+1)%n.length]-n[o]);r.push(n[0]-n[n.length-1]+2*Math.PI);var i=0,a=-Math.PI/2;for(o=0;o<n.length;++o)r[o]>i&&(i=r[o],a=n[o]+r[o]/2);return new j(Math.cos(a),Math.sin(a))}function _(t,e,n,r){for(var o=0,i=t.visel,a=0;a<i.exts.length;++a){var s=i.exts[a].translate(e);o=Math.max(o,j.shiftRayBox(e,n,s))}return o>0&&(e=e.addScaled(n,o+r)),e}var x=t("../../util/box2abs"),w=t("./reobject"),S=t("../../util/scale"),O=t("../../chem/element"),A=t("../draw"),E=t("../util"),j=t("../../util/vec2"),P=t("../../chem/struct");r.prototype=new w,r.isSelectable=function(){return!0},r.prototype.getVBoxObj=function(t){return this.visel.boundingBox?w.prototype.getVBoxObj.call(this,t):new x(this.a.pp,this.a.pp)},r.prototype.drawHighlight=function(t){var e=this.makeHighlightPlate(t);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},r.prototype.makeHighlightPlate=function(t){var e=t.paper,n=t.options,r=S.obj2scaled(this.a.pp,n);return e.circle(r.x,r.y,n.atomSelectionPlateRadius).attr(n.highlightStyle)},r.prototype.makeSelectionPlate=function(t,e,n){var r=S.obj2scaled(this.a.pp,t.render.options);return e.circle(r.x,r.y,n.atomSelectionPlateRadius).attr(n.selectionStyle)},r.prototype.show=function(t,e,n){var r=t.render,_=S.obj2scaled(this.a.pp,r.options);if(this.hydrogenOnTheLeft=a(t.molecule,this),this.showLabel=o(t,r.options,this),this.showLabel){var w=s(this,r.paper,_,n),P=.5*n.lineWidth,T=w.rbb.width/2,C=-w.rbb.width/2,R=Math.floor(this.a.implicitH),N="H"===w.text;t.addReObjectPath("data",this.visel,w.path,_,!0);var k=null;if(n.showAtomIds&&(k={},k.text=e.toString(),k.path=r.paper.text(_.x,_.y,k.text).attr({font:n.font,"font-size":n.fontszsub,fill:"#070"}),k.rbb=E.relBox(k.path.getBBox()),A.recenterText(k.path,k.rbb),t.addReObjectPath("indices",this.visel,k.path,_)),this.setHighlight(this.highlight,r),this.a.alias||this.a.pseudo)return;var I=null;if(N&&R>0&&(I=u(this,r,R,T),T+=I.rbb.width+P,t.addReObjectPath("data",this.visel,I.path,_,!0)),0!=this.a.radical){var B=c(this,r);t.addReObjectPath("data",this.visel,B.path,_,!0)}if(0!=this.a.isotope){var M=l(this,r,C);C-=M.rbb.width+P,t.addReObjectPath("data",this.visel,M.path,_,!0)}if(!N&&R>0&&i(n.showHydrogenLabels,this)){var L=d(this,r,R,{hydrogen:{},hydroIndex:I,rightMargin:T,leftMargin:C}),D=L.hydrogen;I=L.hydroIndex,T=L.rightMargin,C=L.leftMargin,t.addReObjectPath("data",this.visel,D.path,_,!0),null!=I&&t.addReObjectPath("data",this.visel,I.path,_,!0)}if(0!=this.a.charge&&n.showCharge){var F=f(this,r,T);T+=F.rbb.width+P,t.addReObjectPath("data",this.visel,F.path,_,!0)}if(this.a.explicitValence>=0&&n.showValence){var G=p(this,r,T);T+=G.rbb.width+P,t.addReObjectPath("data",this.visel,G.path,_,!0)}if(this.a.badConn&&n.showValenceWarnings){var z=h(this,r,C,T);t.addReObjectPath("warnings",this.visel,z.path,_,!0)}k&&b(k.path,k.rbb,-.5*w.rbb.width-.5*k.rbb.width-P,.3*w.rbb.height)}if(this.a.attpnt){m(this,r,y(this,t.molecule),t.addReObjectPath.bind(t))}var U=g(this),W=v(this);if(U=(W.length>0?W+"\n":"")+(U.length>0?"."+U+".":""),U.length>0){var H=O.map[this.a.label],V=r.paper.text(_.x,_.y,U).attr({font:n.font,"font-size":n.fontszsub,fill:n.atomColoring&&H&&O[H].color?O[H].color:"#000"}),q=E.relBox(V.getBBox());A.recenterText(V,q);for(var K=y(this,t.molecule),Y=this.visel,$=3,Z=0;Z<Y.exts.length;++Z)$=Math.max($,j.shiftRayBox(_,K,Y.exts[Z].translate(_)));$+=j.shiftRayBox(_,K.negated(),x.fromRelBox(q)),K=K.scaled(8+$),b(V,q,K.x,K.y),t.addReObjectPath("data",this.visel,V,_,!0)}},e.exports=r},{"../../chem/element":516,"../../chem/struct":533,"../../util/box2abs":651,"../../util/scale":655,"../../util/vec2":657,"../draw":564,"../util":580,"./reobject":574}],569:[function(t,e,n){"use strict";function r(t){this.init("bond"),this.b=t,this.doubleBondShift=0}function o(t,e,n,r){return t.neighbors.findIndex(function(t){var o=r.molecule.halfBonds.get(t),i=o.bid;if(i===e)return!1;var a=r.bonds.get(i);return a.b.type===P.Bond.PATTERN.TYPE.SINGLE&&a.b.stereo===P.Bond.PATTERN.STEREO.UP?a.b.end===o.begin||a.boldStereo&&n:!(a.b.type!==P.Bond.PATTERN.TYPE.DOUBLE||a.b.stereo!==P.Bond.PATTERN.STEREO.NONE||!n||!a.boldStereo)})}function i(t,e,n){var r=[e.b.begin,e.b.end].map(function(e){var r=n.molecule.atoms.get(e),i=o(r,t,!0,n);return i<0?-1:r.neighbors[i]},this);console.assert(2===r.length),e.neihbid1=n.atoms.get(e.b.begin).showLabel?-1:r[0],e.neihbid2=n.atoms.get(e.b.end).showLabel?-1:r[1]}function a(t,e,n){var r=[e.b.begin,e.b.end].map(function(e){var r=n.molecule.atoms.get(e),i=o(r,t,!1,n);return i<0?-1:r.neighbors[i]},n);console.assert(2===r.length),e.boldStereo=r[0]>=0&&r[1]>=0}function s(t,e,n,r){var o=null,a=t.render,s=t.molecule,f=!t.atoms.get(n.begin).showLabel,p=!t.atoms.get(r.begin).showLabel;switch(e.b.type){case P.Bond.PATTERN.TYPE.SINGLE:switch(e.b.stereo){case P.Bond.PATTERN.STEREO.UP:i(n.bid,e,t),o=e.boldStereo&&e.neihbid1>=0&&e.neihbid2>=0?c(a,n,r,e,s):u(a,n,r,e,s);break;case P.Bond.PATTERN.STEREO.DOWN:o=d(a,n,r);break;case P.Bond.PATTERN.STEREO.EITHER:o=h(a,n,r);break;default:o=T.bondSingle(a.paper,n,r,a.options)}break;case P.Bond.PATTERN.TYPE.DOUBLE:i(n.bid,e,t),o=e.b.stereo===P.Bond.PATTERN.STEREO.NONE&&e.boldStereo&&e.neihbid1>=0&&e.neihbid2>=0?l(a,n,r,e,s,f,p):m(a,n,r,e,f,p);break;case P.Bond.PATTERN.TYPE.TRIPLE:o=T.bondTriple(a.paper,n,r,a.options);break;case P.Bond.PATTERN.TYPE.AROMATIC:o=n.loop>=0&&s.loops.get(n.loop).aromatic||r.loop>=0&&s.loops.get(r.loop).aromatic?T.bondSingle(a.paper,n,r,a.options):v(a,n,r,e,f,p);break;case P.Bond.PATTERN.TYPE.SINGLE_OR_DOUBLE:o=g(a,n,r);break;case P.Bond.PATTERN.TYPE.SINGLE_OR_AROMATIC:case P.Bond.PATTERN.TYPE.DOUBLE_OR_AROMATIC:o=v(a,n,r,e,f,p);break;case P.Bond.PATTERN.TYPE.ANY:o=T.bondAny(a.paper,n,r,a.options);break;default:throw new Error("Bond type "+e.b.type+" not supported")}return o}function u(t,e,n,r,o){var i=e.p,a=n.p,s=e.norm,u=t.options,c=.7*u.stereoBond,l=a.addScaled(s,c),f=a.addScaled(s,-c);if(r.neihbid2>=0){var d=p(n,r.neihbid2,u.stereoBond,o);l=d[0],f=d[1]}return T.bondSingleUp(t.paper,i,l,f,u)}function c(t,e,n,r,o){var i=t.options,a=p(e,r.neihbid1,i.stereoBond,o),s=p(n,r.neihbid2,i.stereoBond,o),u=a[0],c=a[1],l=s[0],f=s[1];return T.bondSingleStereoBold(t.paper,u,c,l,f,i)}function l(t,e,n,r,o,i,a){var s=e.p,u=n.p,l=e.norm,p=r.doubleBondShift,d=1.5*t.options.stereoBond,h=s.addScaled(l,d*p),m=u.addScaled(l,d*p);p>0?(i&&(h=h.addScaled(e.dir,d*f(e.rightCos,e.rightSin))),a&&(m=m.addScaled(e.dir,-d*f(n.leftCos,n.leftSin)))):p<0&&(i&&(h=h.addScaled(e.dir,d*f(e.leftCos,e.leftSin))),a&&(m=m.addScaled(e.dir,-d*f(n.rightCos,n.rightSin))));var g=c(t,e,n,r,o);return T.bondDoubleStereoBold(t.paper,g,h,m,t.options)}function f(t,e){return e<0||Math.abs(t)>.9?0:e/(1-t)}function p(t,e,n,r){var o=r.halfBonds.get(e),i=C.dot(t.dir,o.dir),a=C.cross(t.dir,o.dir),s=Math.sqrt(.5*(1-i)),u=o.dir.rotateSC((a>=0?-1:1)*s,Math.sqrt(.5*(1+i))),c=t.p.addScaled(u,.7*n/(s+.3)),l=t.p.addScaled(u.negated(),.7*n/(s+.3));return a>0?[c,l]:[l,c]}function d(t,e,n){var r=e.p,o=n.p,i=t.options,a=o.sub(r),s=a.length()+.2;a=a.normalized();var u=1.2*i.lineWidth,c=Math.max(Math.floor((s-i.lineWidth)/(i.lineWidth+u)),0)+2,l=s/(c-1);return T.bondSingleDown(t.paper,e,a,c,l,i)}function h(t,e,n){var r=e.p,o=n.p,i=t.options,a=o.sub(r),s=a.length();a=a.normalized();var u=.6*i.lineWidth,c=Math.max(Math.floor((s-i.lineWidth)/(i.lineWidth+u)),0)+2,l=s/(c-.5);return T.bondSingleEither(t.paper,e,a,c,l,i)}function m(t,e,n,r,o,i){var a=r.b.stereo===P.Bond.PATTERN.STEREO.CIS_TRANS,s=e.p,u=n.p,c=e.norm,l=a?0:r.doubleBondShift,p=t.options,d=p.bondSpace/2,h=d+l*d,m=l*d-d,g=s.addScaled(c,h),v=u.addScaled(c,h),b=s.addScaled(c,m),y=u.addScaled(c,m);return l>0?(o&&(g=g.addScaled(e.dir,p.bondSpace*f(e.rightCos,e.rightSin))),i&&(v=v.addScaled(e.dir,-p.bondSpace*f(n.leftCos,n.leftSin)))):l<0&&(o&&(b=b.addScaled(e.dir,p.bondSpace*f(e.leftCos,e.leftSin))),i&&(y=y.addScaled(e.dir,-p.bondSpace*f(n.rightCos,n.rightSin)))),T.bondDouble(t.paper,g,b,v,y,a,p)}function g(t,e,n){var r=e.p,o=n.p,i=t.options,a=(C.dist(r,o)/(i.bondSpace+i.lineWidth)).toFixed()-0;return 1&a||(a+=1),T.bondSingleOrDouble(t.paper,e,n,a,i)}function v(t,e,n,r,o,i){var a=[.125,.125,.005,.125],s=null,u=null,c=t.options,l=r.doubleBondShift;r.b.type==P.Bond.PATTERN.TYPE.SINGLE_OR_AROMATIC&&(s=l>0?1:2,u=a.map(function(t){return t*c.scale})),r.b.type==P.Bond.PATTERN.TYPE.DOUBLE_OR_AROMATIC&&(s=3,u=a.map(function(t){return t*c.scale}));var f=b(e,n,l,o,i,c.bondSpace,s,u);return T.bondAromatic(t.paper,f,l,c)}function b(t,e,n,r,o,i,a,s){var u=t.p,c=e.p,l=t.norm,p=i/2,d=p+n*p,h=n*p-p,m=u.addScaled(l,d),g=c.addScaled(l,d),v=u.addScaled(l,h),b=c.addScaled(l,h);return n>0?(r&&(m=m.addScaled(t.dir,i*f(t.rightCos,t.rightSin))),o&&(g=g.addScaled(t.dir,-i*f(e.leftCos,e.leftSin)))):n<0&&(r&&(v=v.addScaled(t.dir,i*f(t.leftCos,t.leftSin))),o&&(b=b.addScaled(t.dir,-i*f(e.rightCos,e.rightSin)))),T.aromaticBondPaths(m,v,g,b,a,s)}function y(t,e,n,r){var o=n.p,i=r.p,a=i.add(o).scaled(.5),s=i.sub(o).normalized(),u=s.rotateSC(1,0),c=[],l=t.options.lineWidth,f=t.options.bondSpace/2,p=l,d=2*l,h=1.5*f,m=1.5*f,g=3*f;switch(e.b.reactingCenterStatus){case P.Bond.PATTERN.REACTING_CENTER.NOT_CENTER:c.push(a.addScaled(u,g).addScaled(s,.2*g)),c.push(a.addScaled(u,-g).addScaled(s,-.2*g)),c.push(a.addScaled(u,g).addScaled(s,-.2*g)),c.push(a.addScaled(u,-g).addScaled(s,.2*g));break;case P.Bond.PATTERN.REACTING_CENTER.CENTER:c.push(a.addScaled(u,g).addScaled(s,.2*g).addScaled(s,p)),c.push(a.addScaled(u,-g).addScaled(s,-.2*g).addScaled(s,p)),c.push(a.addScaled(u,g).addScaled(s,.2*g).addScaled(s,-p)),c.push(a.addScaled(u,-g).addScaled(s,-.2*g).addScaled(s,-p)),c.push(a.addScaled(s,h).addScaled(u,m)),c.push(a.addScaled(s,-h).addScaled(u,m)),c.push(a.addScaled(s,h).addScaled(u,-m)),c.push(a.addScaled(s,-h).addScaled(u,-m));break;case P.Bond.PATTERN.REACTING_CENTER.MADE_OR_BROKEN:c.push(a.addScaled(u,g).addScaled(s,d)),c.push(a.addScaled(u,-g).addScaled(s,d)),c.push(a.addScaled(u,g).addScaled(s,-d)),c.push(a.addScaled(u,-g).addScaled(s,-d));break;case P.Bond.PATTERN.REACTING_CENTER.ORDER_CHANGED:c.push(a.addScaled(u,g)),c.push(a.addScaled(u,-g));break;case P.Bond.PATTERN.REACTING_CENTER.MADE_OR_BROKEN_AND_CHANGED:c.push(a.addScaled(u,g).addScaled(s,d)),c.push(a.addScaled(u,-g).addScaled(s,d)),c.push(a.addScaled(u,g).addScaled(s,-d)),c.push(a.addScaled(u,-g).addScaled(s,-d)),c.push(a.addScaled(u,g)),c.push(a.addScaled(u,-g));break;default:return null}return T.reactingCenter(t.paper,c,t.options)}function _(t,e,n,r){var o=t.options,i=null;if(e.b.topology==P.Bond.PATTERN.TOPOLOGY.RING)i="rng";else{if(e.b.topology!=P.Bond.PATTERN.TOPOLOGY.CHAIN)return null;i="chn"}var a=n.p,s=r.p,u=s.add(a).scaled(.5),c=s.sub(a).normalized(),l=c.rotateSC(1,0),f=o.lineWidth;e.doubleBondShift>0?l=l.scaled(-e.doubleBondShift):0==e.doubleBondShift&&(f+=o.bondSpace/2);var p=new C(2,1).scaled(o.bondSpace);e.b.type==P.Bond.PATTERN.TYPE.TRIPLE&&(f+=o.bondSpace);var d=u.add(new C(l.x*(p.x+f),l.y*(p.y+f)));return T.topologyMark(t.paper,d,i,o)}function x(t,e,n,r,o,i,a,s){var u=C.lc(n.p,i,r.p,a,s,o),c=e.text(u.x,u.y,t.toString()),l=R.relBox(c.getBBox());return T.recenterText(c,l),c}function w(t,e){var n,r;if(n=e.halfBonds.get(t.b.hb1).loop,r=e.halfBonds.get(t.b.hb2).loop,n>=0&&r>=0){var o=e.loops.get(n).dblBonds,i=e.loops.get(r).dblBonds,a=e.loops.get(n).hbs.length,s=e.loops.get(r).hbs.length;t.doubleBondShift=A(a,s,o,i)}else t.doubleBondShift=n>=0?-1:r>=0?1:E(e,t)}function S(t,e,n){var r=e.render,o=e.atoms.get(t.b.begin),i=e.atoms.get(t.b.end),a=N.obj2scaled(o.a.pp,r.options),s=N.obj2scaled(i.a.pp,r.options),u=e.molecule.halfBonds.get(t.b.hb1),c=e.molecule.halfBonds.get(t.b.hb2);u.p=O(o,a,u.dir,2*n.lineWidth),c.p=O(i,s,c.dir,2*n.lineWidth),t.b.center=C.lc2(o.a.pp,.5,i.a.pp,.5),t.b.len=C.dist(a,s),t.b.sb=5*n.lineWidth,t.b.sa=Math.max(t.b.sb,t.b.len/2-2*n.lineWidth),t.b.angle=180*Math.atan2(u.dir.y,u.dir.x)/Math.PI}function O(t,e,n,r){for(var o=0,i=t.visel,a=0;a<i.exts.length;++a){var s=i.exts[a].translate(e);o=Math.max(o,C.shiftRayBox(e,n,s))}return o>0&&(e=e.addScaled(n,o+r)),e}function A(t,e,n,r){return 6==t&&6!=e&&(n>1||1==r)?-1:6==e&&6!=t&&(r>1||1==n)?1:e*n>t*r?-1:e*n<t*r?1:e>t?-1:1}function E(t,e){var n=t.halfBonds.get(e.b.hb1),r=t.halfBonds.get(e.b.hb2),o=(n.leftSin>.3?1:0)+(r.rightSin>.3?1:0),i=(r.leftSin>.3?1:0)+(n.rightSin>.3?1:0);return o>i?-1:o<i?1:(n.leftSin>.3?1:0)+(n.rightSin>.3?1:0)==1?1:0}var j=t("./reobject"),P=t("../../chem/struct"),T=t("../draw"),C=t("../../util/vec2"),R=t("../util"),N=t("../../util/scale");r.prototype=new j,r.isSelectable=function(){return!0},r.prototype.drawHighlight=function(t){var e=this.makeHighlightPlate(t);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},r.prototype.makeHighlightPlate=function(t){var e=t.options;S(this,t.ctab,e);var n=N.obj2scaled(this.b.center,e);return t.paper.circle(n.x,n.y,.8*e.atomSelectionPlateRadius).attr(e.highlightStyle)},r.prototype.makeSelectionPlate=function(t,e,n){S(this,t,n);var r=N.obj2scaled(this.b.center,n);return e.circle(r.x,r.y,.8*n.atomSelectionPlateRadius).attr(n.selectionStyle)},r.prototype.show=function(t,e,n){var r=t.render,o=t.molecule,i=r.paper,u=o.halfBonds.get(this.b.hb1),c=o.halfBonds.get(this.b.hb2);a(e,this,t),S(this,t,n),w(this,o),this.path=s(t,this,u,c),this.rbb=R.relBox(this.path.getBBox()),t.addReObjectPath("data",this.visel,this.path,null,!0);var l={};l.path=y(r,this,u,c),l.path&&(l.rbb=R.relBox(l.path.getBBox()),t.addReObjectPath("data",this.visel,l.path,null,!0));var f={};f.path=_(r,this,u,c),f.path&&(f.rbb=R.relBox(f.path.getBBox()),t.addReObjectPath("data",this.visel,f.path,null,!0)),this.setHighlight(this.highlight,r);var p=null,d=.6*n.subFontSize;n.showBondIds&&(p=x(e,i,u,c,d,.5,.5,u.norm),t.addReObjectPath("indices",this.visel,p)),n.showHalfBondIds&&(p=x(this.b.hb1,i,u,c,d,.8,.2,u.norm),t.addReObjectPath("indices",this.visel,p),p=x(this.b.hb2,i,u,c,d,.2,.8,c.norm),t.addReObjectPath("indices",this.visel,p)),n.showLoopIds&&!n.showBondIds&&(p=x(u.loop,i,u,c,d,.5,.5,c.norm),t.addReObjectPath("indices",this.visel,p),p=x(c.loop,i,u,c,d,.5,.5,u.norm),t.addReObjectPath("indices",this.visel,p))},e.exports=r},{"../../chem/struct":533,"../../util/scale":655,"../../util/vec2":657,"../draw":564,"../util":580,"./reobject":574}],570:[function(t,e,n){"use strict";function r(t){this.init("chiralFlag"),this.pp=t}var o=t("../../util/box2abs"),i=t("../../util/scale"),a=t("./reobject");r.prototype=new a,r.isSelectable=function(){return!0},r.prototype.highlightPath=function(t){var e=o.fromRelBox(this.path.getBBox()),n=e.p1.sub(e.p0),r=e.p0.sub(t.options.offset);return t.paper.rect(r.x,r.y,n.x,n.y)},r.prototype.drawHighlight=function(t){var e=this.highlightPath(t).attr(t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},r.prototype.makeSelectionPlate=function(t,e,n){return this.highlightPath(t.render).attr(n.selectionStyle)},r.prototype.show=function(t,e,n){var r=t.render;if(!(t.chiralFlagsChanged[e]<=0)){var o=r.paper,a=i.obj2scaled(this.pp,n);this.path=o.text(a.x,a.y,"Chiral").attr({font:n.font,"font-size":n.fontsz,fill:"#000"}),r.ctab.addReObjectPath("data",this.visel,this.path,null,!0)}},e.exports=r},{"../../util/box2abs":651,"../../util/scale":655,"./reobject":574}],571:[function(t,e,n){"use strict";function r(t){this.init("sgroupData"),this.sgroup=t}var o=t("./reobject"),i=t("../../util/scale");r.prototype=new o,r.isSelectable=function(){return!0},r.prototype.highlightPath=function(t){var e=this.sgroup.dataArea,n=i.obj2scaled(e.p0,t.options),r=i.obj2scaled(e.p1,t.options).sub(n);return t.paper.rect(n.x,n.y,r.x,r.y)},r.prototype.drawHighlight=function(t){var e=this.highlightPath(t).attr(t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},r.prototype.makeSelectionPlate=function(t,e,n){return this.highlightPath(t.render).attr(n.selectionStyle)},e.exports=r},{"../../util/scale":655,"./reobject":574}],572:[function(t,e,n){(function(n){"use strict";function r(t){this.init("frag"),this.item=t}var o=t("../../util/box2abs"),i=t("../../util/vec2"),a=t("./reobject"),s=t("../../util/scale");r.prototype=new a,r.isSelectable=function(){return!1},r.prototype.fragGetAtoms=function(t,e){var n=[];return t.ctab.atoms.each(function(t,r){r.a.fragment==e&&n.push(t)},this),n},r.prototype.fragGetBonds=function(t,e){var n=[];return t.ctab.bonds.each(function(r,o){t.ctab.atoms.get(o.b.begin).a.fragment==e&&t.ctab.atoms.get(o.b.end).a.fragment==e&&n.push(r)},this),n},r.prototype.calcBBox=function(t,e,r){var a;return t.atoms.each(function(t,u){if(u.a.fragment==e){var c=u.visel.boundingBox;if(c)r||(console.warn("No boundingBox fragment precalc"),r=n._ui_editor.render),c=c.translate((r.options.offset||new i).negated()).transform(s.scaled2obj,r.options);else{c=new o(u.a.pp,u.a.pp);var l=new i(.05*3,.05*3);c=c.extend(l,l)}a=a?o.union(a,c):c}}),a},r.prototype._draw=function(t,e,n){var r=this.calcBBox(t.ctab,e,t);if(r){var o=s.obj2scaled(new i(r.p0.x,r.p0.y),t.options),a=s.obj2scaled(new i(r.p1.x,r.p1.y),t.options);return t.paper.rect(o.x,o.y,a.x-o.x,a.y-o.y,0).attr(n)}console.assert(null,"Empty fragment")},r.prototype.draw=function(t){return null},r.prototype.drawHighlight=function(t){},r.prototype.setHighlight=function(t,e){var n=e.ctab.frags.keyOf(this);void 0!==n&&(e.ctab.atoms.each(function(r,o){o.a.fragment==n&&o.setHighlight(t,e)},this),e.ctab.bonds.each(function(r,o){e.ctab.atoms.get(o.b.begin).a.fragment==n&&o.setHighlight(t,e)},this))},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../util/box2abs":651,"../../util/scale":655,"../../util/vec2":657,"./reobject":574}],573:[function(t,e,n){"use strict";function r(t){this.loop=t,this.visel=new i("loop"),this.centre=new o,this.radius=new o}var o=t("../../util/vec2"),i=t("./visel"),a=t("./reobject"),s=t("../../util/scale"),u=t("../util"),c=t("../../chem/struct"),l=u.tfx;r.prototype=new a,r.isSelectable=function(){return!1},r.prototype.show=function(t,e,n){var r=t.render,i=r.paper,a=t.molecule,u=this.loop;this.centre=new o,u.hbs.forEach(function(e){var r=a.halfBonds.get(e),o=t.bonds.get(r.bid),i=s.obj2scaled(t.atoms.get(r.begin).a.pp,n);o.b.type!==c.Bond.PATTERN.TYPE.AROMATIC&&(u.aromatic=!1),this.centre.add_(i)},this),u.convex=!0;for(var f=0;f<this.loop.hbs.length;++f){var p=a.halfBonds.get(u.hbs[f]),d=a.halfBonds.get(u.hbs[(f+1)%u.hbs.length]),h=Math.atan2(o.cross(p.dir,d.dir),o.dot(p.dir,d.dir));h>0&&(u.convex=!1)}if(this.centre=this.centre.scaled(1/u.hbs.length),this.radius=-1,u.hbs.forEach(function(e){var r=a.halfBonds.get(e),i=s.obj2scaled(t.atoms.get(r.begin).a.pp,n),u=s.obj2scaled(t.atoms.get(r.end).a.pp,n),c=o.diff(u,i).rotateSC(1,0).normalized(),l=o.dot(o.diff(i,this.centre),c);this.radius=this.radius<0?l:Math.min(this.radius,l)},this),this.radius*=.7,u.aromatic){var m=null;if(u.convex&&n.aromaticCircle)m=i.circle(this.centre.x,this.centre.y,this.radius).attr({stroke:"#000","stroke-width":n.lineattr["stroke-width"]});else{var g="";for(f=0;f<u.hbs.length;++f){p=a.halfBonds.get(u.hbs[f]),d=a.halfBonds.get(u.hbs[(f+1)%u.hbs.length]),h=Math.atan2(o.cross(p.dir,d.dir),o.dot(p.dir,d.dir));var v=(Math.PI-h)/2,b=d.dir.rotate(v),y=s.obj2scaled(t.atoms.get(d.begin).a.pp,n),_=Math.sin(v);Math.abs(_)<.1&&(_=.1*_/Math.abs(_));var x=n.bondSpace/_,w=y.addScaled(b,-x);g+=0===f?"M":"L",g+=l(w.x)+","+l(w.y)}g+="Z",m=i.path(g).attr({stroke:"#000","stroke-width":n.lineattr["stroke-width"],"stroke-dasharray":"- "})}t.addReObjectPath("data",this.visel,m,null,!0)}},r.prototype.isValid=function(t,e){var n=t.halfBonds,r=this.loop,o=!1;return r.hbs.forEach(function(t){n.has(t)&&n.get(t).loop===e||(o=!0)},this),!o},e.exports=r},{"../../chem/struct":533,
"../../util/scale":655,"../../util/vec2":657,"../util":580,"./reobject":574,"./visel":579}],574:[function(t,e,n){"use strict";function r(){}var o=t("./visel"),i=t("../../util/scale");r.prototype.init=function(t){this.visel=new o(t),this.highlight=!1,this.highlighting=null,this.selected=!1,this.selectionPlate=null},r.prototype.getVBoxObj=function(t){var e=this.visel.boundingBox;return null===e?null:(t.options.offset&&(e=e.translate(t.options.offset.negated())),e.transform(i.scaled2obj,t.options))},r.prototype.setHighlight=function(t,e){if(t){var n="highlighting"in this&&null!=this.highlighting;n&&(n="set"==this.highlighting.type?!this.highlighting[0].removed:!this.highlighting.removed),n?this.highlighting.show():(e.paper.setStart(),this.drawHighlight(e),this.highlighting=e.paper.setFinish())}else this.highlighting&&this.highlighting.hide();this.highlight=t},r.prototype.drawHighlight=function(){console.assert("ReObject.drawHighlight is not overridden")},r.prototype.makeSelectionPlate=function(){console.assert(null,"ReObject.makeSelectionPlate is not overridden")},e.exports=r},{"../../util/scale":655,"./visel":579}],575:[function(t,e,n){"use strict";function r(t){this.init("rgroup"),this.labelBox=null,this.item=t}function o(t,e,n,r){r=c.obj2scaled(r||new a(1,0),e.options);var o=Math.min(.25,.3*n.sz().x),i=n.p1.y-n.p0.y,s=.5*(n.p1.y+n.p0.y),l=u.bracket(e.paper,r.negated(),r.negated().rotateSC(1,0),c.obj2scaled(new a(n.p0.x,s),e.options),o,i,e.options),f=u.bracket(e.paper,r,r.rotateSC(1,0),c.obj2scaled(new a(n.p1.x,s),e.options),o,i,e.options);return t.push(l,f)}var i=t("../../util/box2abs"),a=t("../../util/vec2"),s=t("../util"),u=t("../draw"),c=t("../../util/scale"),l=t("./reobject"),f=new a(.05*3,.05*3);r.prototype=new l,r.isSelectable=function(){return!1},r.prototype.getAtoms=function(t){var e=[];return this.item.frags.each(function(n,r){e=e.concat(t.ctab.frags.get(r).fragGetAtoms(t,r))}),e},r.prototype.getBonds=function(t){var e=[];return this.item.frags.each(function(n,r){e=e.concat(t.ctab.frags.get(r).fragGetBonds(t,r))}),e},r.prototype.calcBBox=function(t){var e;return this.item.frags.each(function(n,r){var o=t.ctab.frags.get(r).calcBBox(t.ctab,r,t);o&&(e=e?i.union(e,o):o)}),e=e.extend(f,f)},r.prototype.draw=function(t,e){var n=this.calcBBox(t);if(n){var r={data:[]},a=c.obj2scaled(n.p0,e),u=c.obj2scaled(n.p1,e),l=t.paper.set();o(l,t,n),r.data.push(l);var f=t.ctab.rgroups.keyOf(this),p=t.paper.set(),d=t.paper.text(a.x,(a.y+u.y)/2,"R"+f+"=").attr({font:e.font,"font-size":e.fontRLabel,fill:"black"}),h=s.relBox(d.getBBox());d.translateAbs(-h.width/2-e.lineWidth,0),p.push(d);var m={font:e.font,"font-size":e.fontRLogic,fill:"black"},g=[];g.push((this.item.ifthen>0?"IF ":"")+"R"+f.toString()+(this.item.range.length>0?this.item.range.startsWith(">")||this.item.range.startsWith("<")||this.item.range.startsWith("=")?this.item.range:"="+this.item.range:">0")+(this.item.resth?" (RestH)":"")+(this.item.ifthen>0?"\nTHEN R"+this.item.ifthen.toString():""));for(var v=h.height/2+e.lineWidth/2,b=0;b<g.length;++b){var y=t.paper.text(a.x,(a.y+u.y)/2,g[b]).attr(m),_=s.relBox(y.getBBox());v+=_.height/2,y.translateAbs(-_.width/2-6*e.lineWidth,v),v+=_.height/2+e.lineWidth/2,r.data.push(y),p.push(y)}return r.data.push(d),this.labelBox=i.fromRelBox(p.getBBox()).transform(c.scaled2obj,t.options),r}return{}},r.prototype._draw=function(t,e,n){var r=this.getVBoxObj(t).extend(f,f);if(r){var o=c.obj2scaled(r.p0,t.options),i=c.obj2scaled(r.p1,t.options);return t.paper.rect(o.x,o.y,i.x-o.x,i.y-o.y,0).attr(n)}},r.prototype.drawHighlight=function(t){var e=t.ctab.rgroups.keyOf(this);if(void 0!==e){var n=this._draw(t,e,t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,n),this.item.frags.each(function(e,n){t.ctab.frags.get(n).drawHighlight(t)},this),n}},r.prototype.show=function(t,e,n){var r=this.draw(t.render,n);for(var o in r)if(r.hasOwnProperty(o))for(;r[o].length>0;)t.addReObjectPath(o,this.visel,r[o].shift(),null,!0)},e.exports=r},{"../../util/box2abs":651,"../../util/scale":655,"../../util/vec2":657,"../draw":564,"../util":580,"./reobject":574}],576:[function(t,e,n){"use strict";function r(t){this.init("rxnArrow"),this.item=t}var o=t("./reobject"),i=t("../../util/box2abs"),a=t("../../util/vec2"),s=t("../draw"),u=t("../util"),c=t("../../util/scale");r.prototype=new o,r.isSelectable=function(){return!0},r.prototype.highlightPath=function(t){var e=c.obj2scaled(this.item.pp,t.options),n=t.options.scale;return t.paper.rect(e.x-n,e.y-n/4,2*n,n/2,n/8)},r.prototype.drawHighlight=function(t){var e=this.highlightPath(t).attr(t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},r.prototype.makeSelectionPlate=function(t,e,n){return this.highlightPath(t.render).attr(n.selectionStyle)},r.prototype.show=function(t,e,n){var r=t.render,o=c.obj2scaled(this.item.pp,n),l=s.arrow(r.paper,new a(o.x-n.scale,o.y),new a(o.x+n.scale,o.y),n),f=n.offset;null!=f&&l.translateAbs(f.x,f.y),this.visel.add(l,i.fromRelBox(u.relBox(l.getBBox())))},e.exports=r},{"../../util/box2abs":651,"../../util/scale":655,"../../util/vec2":657,"../draw":564,"../util":580,"./reobject":574}],577:[function(t,e,n){"use strict";function r(t){this.init("rxnPlus"),this.item=t}var o=t("./reobject"),i=t("../../util/box2abs"),a=t("../draw"),s=t("../util"),u=t("../../util/scale");r.prototype=new o,r.isSelectable=function(){return!0},r.prototype.highlightPath=function(t){var e=u.obj2scaled(this.item.pp,t.options),n=t.options.scale;return t.paper.rect(e.x-n/4,e.y-n/4,n/2,n/2,n/8)},r.prototype.drawHighlight=function(t){var e=this.highlightPath(t).attr(t.options.highlightStyle);return t.ctab.addReObjectPath("highlighting",this.visel,e),e},r.prototype.makeSelectionPlate=function(t,e,n){return this.highlightPath(t.render).attr(n.selectionStyle)},r.prototype.show=function(t,e,n){var r=t.render,o=u.obj2scaled(this.item.pp,n),c=a.plus(r.paper,o,n),l=n.offset;null!=l&&c.translateAbs(l.x,l.y),this.visel.add(c,i.fromRelBox(s.relBox(c.getBBox())))},e.exports=r},{"../../util/box2abs":651,"../../util/scale":655,"../draw":564,"../util":580,"./reobject":574}],578:[function(t,e,n){"use strict";function r(t){this.init("sgroup"),this.item=t}function o(t,e,n,r,o,i,a,s,u,c){function l(n,r){var o=v.obj2scaled(w.c.addScaled(w.n,r*w.h),e.options),i=e.paper.text(o.x,o.y,n).attr({font:e.options.font,"font-size":e.options.fontszsub});c&&i.attr(c);var a=d.fromRelBox(g.relBox(i.getBBox())),s=Math.max(m.shiftRayBox(o,w.d.negated(),a),3)+2;i.translateAbs(s*w.d.x,s*w.d.y),t.push(i)}for(var f=p(e.ctab.molecule,r,o,i,a,e,n.id),h=-1,b=0;b<f.length;++b){var _=f[b],x=y.bracket(e.paper,v.obj2scaled(_.d,e.options),v.obj2scaled(_.n,e.options),v.obj2scaled(_.c,e.options),_.w,_.h,e.options);t.push(x),(h<0||f[h].d.x<_.d.x||f[h].d.x==_.d.x&&f[h].d.y>_.d.y)&&(h=b)}var w=f[h];s&&l(s,.5),u&&l(u,-.5)}function i(t,e,n,r){var o=t.text(e.x,e.y,n.data.fieldValue).attr({font:r.font,"font-size":r.fontsz}),i=o.getBBox(),a=t.rect(i.x-1,i.y-1,i.width+2,i.height+2,3,3);a=n.selected?a.attr(r.selectionStyle):a.attr({fill:"#fff",stroke:"#fff"});var s=t.set();return s.push(a,o.toFront()),s}function a(t,e){return f(e,t.render,t.molecule),e.areas=e.bracketBox?[e.bracketBox]:[],null===e.pp&&(e.pp=s(t,e)),e.data.attached?l(t,e):c(t,e)}function s(t,e){for(var n=e.bracketBox.p1.add(new m(.5,.5)),r=t.molecule.sgroups.values(),o=0;o<t.molecule.sgroups.count()&&u(r,n);++o)n=n.add(new m(0,.5));return n}function u(t,e){return t.some(function(t){if(!t.pp)return!1;var n=t.pp.add(new m(.5,.5)),r=e.add(new m(.5,.5));return m.segmentIntersection(t.pp,n,e,r)})}function c(t,e){var n=t.render,r=n.options,o=n.paper,a=o.set(),s=e.pp.scaled(r.scale),u=i(o,s,e,r),c=g.relBox(u.getBBox());u.translateAbs(.5*c.width,-.5*c.height),a.push(u);var l=d.fromRelBox(g.relBox(u.getBBox()));return e.dataArea=l.transform(v.scaled2obj,n.options),t.sgroupData.has(e.id)||t.sgroupData.set(e.id,new _(e)),a}function l(t,e){var n=t.render,r=n.options,o=n.paper,a=o.set();return b.SGroup.getAtoms(t,e).forEach(function(s){var u=t.atoms.get(s),c=v.obj2scaled(u.a.pp,r),l=u.visel.boundingBox;null!==l&&(c.x=Math.max(c.x,l.p1.x)),c.x+=r.lineWidth;var f=i(o,c,e,r),p=g.relBox(f.getBBox());f.translateAbs(.5*p.width,-.3*p.height),a.push(f);var h=d.fromRelBox(g.relBox(f.getBBox()));h=h.transform(v.scaled2obj,n.options),e.areas.push(h)}),a}function f(t,e,n,r){var o=t.atoms;if(r&&2===r.length){var i=n.bonds.get(r[0]).getCenter(n),a=n.bonds.get(r[1]).getCenter(n);t.bracketDir=m.diff(a,i).normalized()}else t.bracketDir=new m(1,0);var s=t.bracketDir,u=null,c=[];o.forEach(function(t){var r=n.atoms.get(t),o=e?e.ctab.atoms.get(t).visel.boundingBox:null;if(o)o=o.translate((e.options.offset||new m).negated()).transform(v.scaled2obj,e.options);else{var i=new m(r.pp),a=new m(.05*3,.05*3);o=new d(i,i).extend(a,a)}c.push(o)},this),n.sGroupForest.children.get(t.id).forEach(function(t){var n=e.ctab.sgroups.get(t).visel.boundingBox;n=n.translate((e.options.offset||new m).negated()).transform(v.scaled2obj,e.options),c.push(n)},this),c.forEach(function(t){var e=null;[t.p0.x,t.p1.x].forEach(function(n){[t.p0.y,t.p1.y].forEach(function(t){var r=new m(n,t),o=new m(m.dot(r,s),m.dot(r,s.rotateSC(1,0)));e=null===e?new d(o,o):e.include(o)},this)},this),u=null===u?e:d.union(u,e)},this);var l=new m(.2,.4);null!==u&&(u=u.extend(l,l)),t.bracketBox=u}function p(t,e,n,r,o,i,a){function s(t,e,n,r){this.c=t,this.d=e,this.n=e.rotateSC(1,0),this.w=n,this.h=r}var u=[],c=o.rotateSC(1,0);return e.length<2?function(){o=o||new m(1,0),c=c||o.rotateSC(1,0);var t=Math.min(.25,.3*r.sz().x),e=m.lc2(o,r.p0.x,c,.5*(r.p0.y+r.p1.y)),n=m.lc2(o,r.p1.x,c,.5*(r.p0.y+r.p1.y)),i=r.sz().y;u.push(new s(e,o.negated(),t,i),new s(n,o,t,i))}():2===e.length?function(){var n=t.bonds.get(e[0]),r=t.bonds.get(e[1]),o=n.getCenter(t),c=r.getCenter(t),l=-1,f=-1,p=-1,d=-1,h=m.centre(o,c),g=m.diff(c,o).normalized(),b=g.negated(),y=g.rotateSC(1,0),_=y.negated();t.sGroupForest.children.get(a).forEach(function(t){var e=i.ctab.sgroups.get(t).visel.boundingBox;e=e.translate((i.options.offset||new m).negated()).transform(v.scaled2obj,i.options),l=Math.max(l,m.shiftRayBox(o,b,e)),f=Math.max(f,m.shiftRayBox(c,g,e)),p=Math.max(p,m.shiftRayBox(h,y,e)),d=Math.max(d,m.shiftRayBox(h,_,e))},this),l=Math.max(l+.2,0),f=Math.max(f+.2,0),p=Math.max(Math.max(p,d)+.1,0);var x=1.5+p;u.push(new s(o.addScaled(b,l),b,.25,x),new s(c.addScaled(g,f),g,.25,x))}():function(){for(var r=0;r<e.length;++r){var o=t.bonds.get(e[r]),i=o.getCenter(t),a=h.contains(n,o.begin)?o.getDir(t):o.getDir(t).negated();u.push(new s(i,a,.2,1))}}(),u}var d=t("../../util/box2abs"),h=t("../../util/set"),m=t("../../util/vec2"),g=t("../util"),v=t("../../util/scale"),b=t("../../chem/struct"),y=t("../draw"),_=t("./redatasgroupdata"),x=t("./reobject"),w=g.tfx;r.prototype=new x,r.isSelectable=function(){return!1},r.prototype.draw=function(t,e){var n=t.render,r=n.paper.set(),i=[],s=[],u=h.fromList(e.atoms);b.SGroup.getCrossBonds(i,s,t.molecule,u),f(e,n,t.molecule,s);var c=e.bracketBox,l=e.bracketDir;switch(e.areas=[c],e.type){case"MUL":new o(r,n,e,s,u,c,l,e.data.mul);break;case"SRU":var p=e.data.connectivity||"eu";"ht"==p&&(p="");new o(r,n,e,s,u,c,l,e.data.subscript||"n",p);break;case"SUP":new o(r,n,e,s,u,c,l,e.data.name,null,{"font-style":"italic"});break;case"GEN":new o(r,n,e,s,u,c,l);break;case"DAT":r=a(t,e)}return r},r.prototype.drawHighlight=function(t){var e=t.options,n=t.paper,r=this.item,o=r.bracketBox.transform(v.obj2scaled,e),i=e.lineWidth,a=new m(4*i,6*i);o=o.extend(a,a);var s=r.bracketDir,u=s.rotateSC(1,0),c=m.lc2(s,o.p0.x,u,o.p0.y),l=m.lc2(s,o.p0.x,u,o.p1.y),f=m.lc2(s,o.p1.x,u,o.p0.y),p=m.lc2(s,o.p1.x,u,o.p1.y),d=n.set();r.highlighting=n.path("M{0},{1}L{2},{3}L{4},{5}L{6},{7}L{0},{1}",w(c.x),w(c.y),w(l.x),w(l.y),w(p.x),w(p.y),w(f.x),w(f.y)).attr(e.highlightStyle),d.push(r.highlighting),b.SGroup.getAtoms(t.ctab.molecule,r).forEach(function(e){d.push(t.ctab.atoms.get(e).makeHighlightPlate(t))},this),b.SGroup.getBonds(t.ctab.molecule,r).forEach(function(e){d.push(t.ctab.bonds.get(e).makeHighlightPlate(t))},this),t.ctab.addReObjectPath("highlighting",this.visel,d)},r.prototype.show=function(t){var e=t.render,n=this.item;if("MRV_IMPLICIT_H"!==n.data.fieldName){var r=e.ctab,o=this.draw(r,n);t.addReObjectPath("data",this.visel,o,null,!0),this.setHighlight(this.highlight,e)}},e.exports=r},{"../../chem/struct":533,"../../util/box2abs":651,"../../util/scale":655,"../../util/set":656,"../../util/vec2":657,"../draw":564,"../util":580,"./redatasgroupdata":571,"./reobject":574}],579:[function(t,e,n){"use strict";function r(t){this.type=t,this.paths=[],this.boxes=[],this.boundingBox=null}var o=t("../../util/box2abs"),i=t("../../util/vec2");r.prototype.add=function(t,e,n){this.paths.push(t),e&&(this.boxes.push(e),this.boundingBox=null==this.boundingBox?e:o.union(this.boundingBox,e)),n&&this.exts.push(n)},r.prototype.clear=function(){this.paths=[],this.boxes=[],this.exts=[],this.boundingBox=null},r.prototype.translate=function(t,e){if(arguments.length>2)throw new Error("One vector or two scalar arguments expected");if(void 0===e)this.translate(t.x,t.y);else{for(var n=new i(t,e),r=0;r<this.paths.length;++r)this.paths[r].translateAbs(t,e);for(var o=0;o<this.boxes.length;++o)this.boxes[o]=this.boxes[o].translate(n);null!==this.boundingBox&&(this.boundingBox=this.boundingBox.translate(n))}},e.exports=r},{"../../util/box2abs":651,"../../util/vec2":657}],580:[function(t,e,n){"use strict";function r(t){return(t-0).toFixed(8)}function o(t){return{x:t.x,y:t.y,width:t.width,height:t.height}}e.exports={tfx:r,relBox:o}},{}],581:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=(n.basic=["H","C","N","O","S","P","F","Cl","Br","I"],n.atomCuts={H:"h",C:"c",N:"n",O:"o",S:"s",P:"p",F:"f",Cl:"Shift+c",Br:"Shift+b",I:"i",A:"a"});n.default=Object.keys(r).reduce(function(t,e){return t["atom-"+e.toLowerCase()]={title:"Atom "+e,shortcut:r[e],action:{tool:"atom",opts:{label:e}}},t},{})},{}],582:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("../../chem/molfile"),o=function(t){return t&&t.__esModule?t:{default:t}}(r);n.default={"force-update":{shortcut:"Ctrl+Shift+r",action:function(t){t.update(!0)}},"qs-serialize":{shortcut:"Alt+Shift+r",action:function(t){var e=o.default.stringify(t.struct()),n="mol="+encodeURIComponent(e).replace(/%20/g,"+"),r=document.location.search;document.location.search=r?-1===r.search("mol=")?r+"&"+n:r.replace(/mol=[^&$]*/,n):"?"+n}}}},{"../../chem/molfile":519}],583:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=t.selection();return e&&(Object.keys(e).length>1||!e.sgroupData)}function i(t){alert("These action is unavailble via menu.\nInstead, use shortcut to "+t+".")}Object.defineProperty(n,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=t("./tools"),u=r(s),c=t("./atoms"),l=r(c),f=t("./zoom"),p=r(f),d=t("./server"),h=r(d),m=t("./debug"),g=r(m),v=t("./templates"),b=r(v),y=t("../component/cliparea"),_=t("../state/miew");n.default=a({new:{shortcut:"Mod+Delete",title:"Clear Canvas",action:{thunk:function(t,e){var n=e().editor;n.struct().isBlank()||n.struct(null),t({type:"ACTION",action:u.default["select-lasso"].action})}}},open:{shortcut:"Mod+o",title:"Open…",action:{dialog:"open"}},save:{shortcut:"Mod+s",title:"Save As…",action:{dialog:"save"}},undo:{shortcut:"Mod+z",title:"Undo",action:function(t){t.undo()},disabled:function(t){return 0===t.historySize().undo}},redo:{shortcut:["Mod+Shift+z","Mod+y"],title:"Redo",action:function(t){t.redo()},disabled:function(t){return 0===t.historySize().redo}},cut:{shortcut:"Mod+x",title:"Cut",action:function(){(0,y.exec)("cut")||i("Cut")},disabled:function(t){return!o(t)}},copy:{shortcut:"Mod+c",title:"Copy",action:function(){(0,y.exec)("copy")||i("Copy")},disabled:function(t){return!o(t)}},paste:{shortcut:"Mod+v",title:"Paste",action:function(){(0,y.exec)("paste")||i("Paste")},selected:function(t){var e=t.actions;return e&&e.active&&"paste"===e.active.tool}},check:{title:"Check Structure",action:{dialog:"check"},disabled:function(t,e,n){return!n.app.server}},analyse:{title:"Calculated Values",action:{dialog:"analyse"},disabled:function(t,e,n){return!n.app.server}},recognize:{title:"Recognize Molecule",action:{dialog:"recognize"},disabled:function(t,e,n){return!n.app.server}},miew:{title:"3D Viewer",action:{thunk:_.miewAction},disabled:function(t,e,n){return!n.app.server||!n.app.miewPath}},settings:{title:"Settings",action:{dialog:"settings"}},help:{shortcut:["?","Shift+/"],title:"Help",action:{dialog:"help"}},about:{title:"About",action:{dialog:"about"}},"reaction-automap":{title:"Reaction Auto-Mapping Tool",action:{dialog:"automap"},disabled:function(t,e,n){return!n.app.server||!t.struct().hasRxnArrow()}},"period-table":{title:"Periodic Table",action:{dialog:"period-table"}},"select-all":{title:"Select All",shortcut:"Mod+a",action:{thunk:function(t,e){e().editor.selection("all"),t({type:"ACTION",action:u.default["select-lasso"].action})}}},"deselect-all":{title:"Deselect All",shortcut:"Mod+Shift+a",action:function(t){t.selection(null)}},"select-descriptors":{title:"Select descriptors",shortcut:"Mod+d",action:{thunk:function(t,e){var n=e().editor;n.alignDescriptors(),n.selection("descriptors"),t({type:"ACTION",action:u.default["select-lasso"].action})}}}},h.default,g.default,u.default,l.default,p.default,b.default)},{"../component/cliparea":592,"../state/miew":640,"./atoms":581,"./debug":582,"./server":584,"./templates":585,"./tools":586,"./zoom":587}],584:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("../state/server");n.default={layout:{shortcut:"Mod+l",title:"Layout",action:{thunk:(0,r.serverTransform)("layout")},disabled:function(t,e,n){return!n.app.server}},clean:{shortcut:"Mod+Shift+l",title:"Clean Up",action:{thunk:(0,r.serverTransform)("clean")},disabled:function(t,e,n){return!n.app.server}},arom:{title:"Aromatize",action:{thunk:(0,r.serverTransform)("aromatize")},disabled:function(t,e,n){return!n.app.server}},dearom:{title:"Dearomatize",action:{thunk:(0,r.serverTransform)("dearomatize")},disabled:function(t,e,n){return!n.app.server}},cip:{shortcut:"Mod+p",title:"Calculate CIP",action:{thunk:(0,r.serverTransform)("calculateCip")},disabled:function(t,e,n){return!n.app.server}}}},{"../state/server":643}],585:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("../data/templates"),o=function(t){return t&&t.__esModule?t:{default:t}}(r),i={"template-lib":{shortcut:"Shift+t",title:"Custom Templates",action:{dialog:"templates"},disabled:function(t,e,n){return!n.app.templates}}};n.default=o.default.reduce(function(t,e,n){return t["template-"+n]={title:""+e.name,shortcut:"t",action:{tool:"template",opts:{struct:e}}},t},i)},{"../data/templates":609}],586:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("../structschema"),o=t("../structconv"),i={"select-lasso":{title:"Lasso Selection",shortcut:"Escape",action:{tool:"select",opts:"lasso"}},"select-rectangle":{title:"Rectangle Selection",shortcut:"Escape",action:{tool:"select",opts:"rectangle"}},"select-fragment":{title:"Fragment Selection",shortcut:"Escape",action:{tool:"select",opts:"fragment"}},erase:{title:"Erase",shortcut:["Delete","Backspace"],action:{tool:"eraser",opts:1}},chain:{title:"Chain",action:{tool:"chain"}},"chiral-flag":{title:"Chiral Flag",action:{tool:"chiralFlag"},selected:function(t){return t.struct().isChiral}},"charge-plus":{shortcut:"5",title:"Charge Plus",action:{tool:"charge",opts:1}},"charge-minus":{shortcut:"5",title:"Charge Minus",action:{tool:"charge",opts:-1}},"transform-rotate":{shortcut:"Alt+r",title:"Rotate Tool",action:{tool:"rotate"}},"transform-flip-h":{shortcut:"Alt+h",title:"Horizontal Flip",action:{tool:"rotate",opts:"horizontal"}},"transform-flip-v":{shortcut:"Alt+v",title:"Vertical Flip",action:{tool:"rotate",opts:"vertical"}},sgroup:{shortcut:"Mod+g",title:"S-Group",action:{tool:"sgroup"}},"sgroup-data":{shortcut:"Mod+g",title:"Data S-Group",action:{tool:"sgroup",opts:"DAT"}},"reaction-arrow":{title:"Reaction Arrow Tool",action:{tool:"reactionarrow"}},"reaction-plus":{title:"Reaction Plus Tool",action:{tool:"reactionplus"}},"reaction-map":{title:"Reaction Mapping Tool",action:{tool:"reactionmap"}},"reaction-unmap":{title:"Reaction Unmapping Tool",action:{tool:"reactionunmap"}},"rgroup-label":{shortcut:"Mod+r",title:"R-Group Label Tool",action:{tool:"rgroupatom"}},"rgroup-fragment":{shortcut:["Mod+Shift+r","Mod+r"],title:"R-Group Fragment Tool",action:{tool:"rgroupfragment"}},"rgroup-attpoints":{shortcut:"Mod+r",title:"Attachment Point Tool",action:{tool:"apoint"}}},a={single:"1",double:"2",triple:"3",up:"1",down:"1",updown:"1",crossed:"2",any:"0",aromatic:"4"},s=r.bond.properties.type;n.default=s.enum.reduce(function(t,e,n){return t["bond-"+e]={title:s.enumNames[n]+" Bond",shortcut:a[e],action:{tool:"bond",opts:(0,o.toBondType)(e)}},t},i)},{"../structconv":646,"../structschema":648}],587:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(n,"__esModule",{value:!0}),n.zoomList=void 0;var o=t("lodash/fp/findLastIndex"),i=r(o),a=t("lodash/fp/findIndex"),s=r(a),u=n.zoomList=[.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2,1.3,1.4,1.5,1.7,2,2.5,3,3.5,4];n.default={zoom:{selected:function(t){return t.zoom()}},"zoom-out":{shortcut:["-","_","Shift+-"],title:"Zoom Out",disabled:function(t){return t.zoom()<=u[0]},action:function(t){var e=t.zoom(),n=(0,s.default)(function(t){return t>=e},u);t.zoom(u[u[n]===e&&n>0?n-1:n])}},"zoom-in":{shortcut:["+","=","Shift+="],title:"Zoom In",disabled:function(t){return u[u.length-1]<=t.zoom()},action:function(t){var e=t.zoom(),n=(0,i.default)(function(t){return t<=e},u);t.zoom(u[u[n]===e&&n<u.length-1?n+1:n])}}}},{"lodash/fp/findIndex":427,"lodash/fp/findLastIndex":428}],588:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function u(t,e,n){var r=(0,m.default)(e,n);return r.dispatch((0,y.initKeydownListener)(t)),r.dispatch((0,_.initResize)()),(0,x.render)((0,x.h)(d.Provider,{store:r},(0,x.h)(I,null)),t),{load:function(t,e){return r.dispatch((0,h.load)(t,e))}}}Object.defineProperty(n,"__esModule",{value:!0});var c=t("lodash/fp/omit"),l=r(c),f=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},d=t("preact-redux"),h=t("./state"),m=r(h),g=t("./state/templates"),v=t("./state/editor"),b=t("./state/server"),y=t("./state/hotkeys"),_=t("./state/toolbar"),x=t("preact"),w=t("./toolbar"),S=r(w),O=t("./component/structeditor"),A=r(O),E=t("./component/cliparea"),j=r(E),P=t("./dialog"),T=r(P),C=(0,d.connect)(function(t){return{options:t.options.settings}},function(t){return t(v.initEditor)})(A.default),R=(0,d.connect)(function(t){return{modal:t.modal}},function(t){return{onOk:function(e){console.info("Output:",e),t({type:"MODAL_CLOSE"})},onCancel:function(){t({type:"MODAL_CLOSE"})}}},function(t,e){var n=t.modal&&t.modal.prop,r=n?(0,l.default)(["onResult","onCancel"],n):{};return p({modal:t.modal},r,{onOk:function(t){n&&n.onResult&&n.onResult(t),e.onOk(t)},onCancel:function(){n&&n.onCancel&&n.onCancel(),e.onCancel()}})})(function(t){var e=t.modal,n=s(t,["modal"]);if(!e)return null;var r=T.default[e.name];if(!r)throw new Error("There is no modal window named "+e.name);return(0,x.h)("div",{className:"overlay"},(0,x.h)(r,n))}),N=(0,d.connect)(null,function(t){return{onInitTmpls:function(e){return(0,g.initTmplLib)(t,"",e)}}})(function(t){function e(){var t,n,r,a;o(this,e);for(var s=arguments.length,u=Array(s),c=0;c<s;c++)u[c]=arguments[c];return n=r=i(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),r.render=function(){return(0,x.h)("div",{className:"cellar",ref:function(t){return r.cacheEl=t}})},a=n,i(r,a)}return a(e,t),f(e,[{key:"componentDidMount",value:function(){this.props.onInitTmpls(this.cacheEl)}}]),e}(x.Component)),k=(0,d.connect)(null,function(t){return t(y.initClipboard)})(j.default),I=(0,d.connect)(null,{onAction:h.onAction,checkServer:b.checkServer})(function(t){function e(){var t,n,r,a;o(this,e);for(var s=arguments.length,u=Array(s),c=0;c<s;c++)u[c]=arguments[c];return n=r=i(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),r.render=function(t){return(0,x.h)("main",{role:"application"},(0,x.h)(C,{id:"canvas"}),(0,x.h)(S.default,t),(0,x.h)(k,null),(0,x.h)(R,null),(0,x.h)(N,null))},a=n,i(r,a)}return a(e,t),f(e,[{key:"componentDidMount",value:function(){this.props.checkServer()}}]),e}(x.Component));n.default=u},{"./component/cliparea":592,"./component/structeditor":602,"./dialog":619,"./state":639,"./state/editor":636,"./state/hotkeys":638,"./state/server":643,"./state/templates":644,"./state/toolbar":645,"./toolbar":649,"lodash/fp/omit":432,preact:483,"preact-redux":482}],589:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=t("preact"),c=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state.active=t.active?t.active:{},n}return a(e,t),s(e,[{key:"onActive",value:function(t){var e={};e[t]=!this.state.active[t],this.setState({active:Object.assign(this.state.active,e)}),this.props.onActive&&this.props.onActive()}},{key:"render",value:function(){var t=this,e=this.props,n=e.children,o=e.captions,i=r(e,["children","captions"]);return(0,u.h)("ul",i,o.map(function(e,r){return(0,u.h)("li",{className:"tab"},(0,u.h)("a",{className:t.state.active[r]?"active":"",onClick:function(){return t.onActive(r)}},e),t.state.active[r]?n[r]:null)}))}}]),e}(u.Component);n.default=c},{preact:483}],590:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t){return(Array.isArray(t)?t[0]:t).replace(/(\b[a-z]\b$|Mod|Escape|Delete)/g,function(t){return y[t]||t.toUpperCase()})}function a(t){var e=t.action,n=t.status,r=void 0===n?{}:n,a=t.onAction,s=(o(t,["action","status","onAction"]),e.shortcut&&i(e.shortcut));return(0,p.h)("button",{disabled:r.disabled,onClick:function(t){r.selected&&"chiralFlag"!==e.action.tool||(a(e.action),t.stopPropagation())},title:s?e.title+" ("+s+")":e.title},e.title)}function s(t){var e=t.name,n=t.menu,r=t.className,i=t.role,d=o(t,["name","menu","className","role"]);return(0,p.h)("menu",{className:r,role:i,style:u(e,n,d.visibleTools)},n.map(function(t){return(0,p.h)("li",{id:t.id||t,className:(0,h.default)(d.status[t])+" "+(t.id===d.opened?"opened":""),onClick:function(t){return c(t,d.onOpen)}},"object"!==(void 0===t?"undefined":f(t))?(0,p.h)(a,l({},d,{action:g.default[t],status:d.status[t]})):t.menu?(0,p.h)(s,l({},d,{name:t.id,menu:t.menu})):t.component(d))}))}function u(t,e,n){if(!n[t])return{};var r=window.innerHeight<600||window.innerWidth<1040?32:40,o=e.indexOf(n[t]);if(-1===o){var i=[];e.forEach(function(t){return i=i.concat(t.menu)}),o=i.indexOf(n[t])}return-1!==o?{marginTop:-r*o+"px"}:{}}function c(t,e){var n=(0,v.hiddenAncestor)(t.currentTarget);n&&e(n.id),t.stopPropagation()}Object.defineProperty(n,"__esModule",{value:!0});var l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};n.shortcutStr=i;var p=t("preact"),d=t("classnames"),h=r(d),m=t("../action"),g=r(m),v=t("../state/toolbar"),b=/Mac/.test(navigator.platform),y={Escape:"Esc",Delete:"Del",Mod:b?"⌘":"Ctrl"};n.default=s},{"../action":583,"../state/toolbar":645,classnames:2,preact:483}],591:[function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t){return["atom-"+t.label.toLowerCase(),f.indexOf(t.type)>=0?t.type+" metal":t.type||"unknown-props",t.state||"unknown-state",t.origin]}function a(t){var e=t.el,n=t.shortcut,a=t.className,c=o(t,["el","shortcut","className"]);return(0,u.h)("button",s({title:n?e.title+" ("+n+")":e.title,className:[].concat(r(i(e)),[a]).join(" "),value:l.default.map[e.label]},c),e.label)}Object.defineProperty(n,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=t("preact"),c=t("../../chem/element"),l=function(t){return t&&t.__esModule?t:{default:t}}(c),f=["alkali","alkaline-earth","transition","post-transition"];n.default=a},{"../../chem/element":516,preact:483}],592:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return("INPUT"!==t.tagName||"button"!==t.type)&&["INPUT","SELECT","TEXTAREA"].indexOf(t.tagName)>-1}function s(t){t.value=" ",t.focus(),t.select()}function u(t,e){if(!t&&d)d.setData("text",e["text/plain"]);else{t.setData("text/plain",e["text/plain"]);try{
Object.keys(e).forEach(function(n){t.setData(n,e[n])})}catch(t){console.info("Could not write exact type",t)}}}function c(t,e){var n={};return!t&&d?n["text/plain"]=d.getData("text"):(n["text/plain"]=t.getData("text/plain"),n=e.reduce(function(e,n){var r=t.getData(n);return r&&(e[n]=r),e},n)),n}function l(t){var e=document.queryCommandSupported(t);if(e)try{e=document.execCommand(t)||d}catch(t){e=!1}return e}Object.defineProperty(n,"__esModule",{value:!0}),n.actions=void 0;var f=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();n.exec=l;var p=t("preact"),d=window.clipboardData,h=function(t){function e(){return r(this,e),o(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return i(e,t),f(e,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentDidMount",value:function(){var t=this,e=this.refs?this.refs.base:this.base;this.target=this.props.target||e.parentNode,this.listeners={mouseup:function(n){t.props.focused()&&!a(n.target)&&s(e)},copy:function(e){if(t.props.focused()&&t.props.onCopy){var n=t.props.onCopy();n&&u(e.clipboardData,n),e.preventDefault()}},cut:function(e){if(t.props.focused()&&t.props.onCut){var n=t.props.onCut();n&&u(e.clipboardData,n),e.preventDefault()}},paste:function(e){if(t.props.focused()&&t.props.onPaste){var n=c(e.clipboardData,t.props.formats);n&&t.props.onPaste(n),e.preventDefault()}}},Object.keys(this.listeners).forEach(function(e){t.target.addEventListener(e,t.listeners[e])})}},{key:"componentWillUnmount",value:function(){var t=this;Object.keys(this.listeners).forEach(function(e){t.target.removeEventListener(e,t.listeners[e])})}},{key:"render",value:function(){return(0,p.h)("textarea",{className:"cliparea",contentEditable:!0,autoFocus:!0})}}]),e}(p.Component);n.actions=["cut","copy","paste"];n.default=h},{preact:483}],593:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=t("preact"),u=function(t){function e(t){r(this,e);var n=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state={suggestsHidden:!0},n.click=n.click.bind(n),n.blur=n.blur.bind(n),n.updateInput=n.updateInput.bind(n),n}return i(e,t),a(e,[{key:"updateInput",value:function(t){var e=t.target.value||t.target.textContent;this.setState({suggestsHidden:!0}),this.props.onChange(e)}},{key:"click",value:function(){this.setState({suggestsHidden:!1})}},{key:"blur",value:function(){this.setState({suggestsHidden:!0})}},{key:"render",value:function(t){var e=this,n=t.value,r=t.type,o=void 0===r?"text":r,i=t.schema,a=i.enumNames.filter(function(t){return t!==n}).map(function(t){return(0,s.h)("li",{onMouseDown:e.updateInput},t)});return(0,s.h)("div",null,(0,s.h)("input",{type:o,value:n,onClick:this.click,onBlur:this.blur,onInput:this.updateInput,autocomplete:"off"}),0!==a.length?(0,s.h)("ui",{className:"suggestList",style:"display: "+(this.state.suggestsHidden?"none":"block")},a):"")}}]),e}(s.Component);n.default=u},{preact:483}],594:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=t("preact"),l=t("w3c-keyname"),f=function(t){return t&&t.__esModule?t:{default:t}}(l),p=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"exit",value:function(t){var e=this.props,n=e.params,r=e.result,o=void 0===r?function(){return null}:r,i=e.valid,a=void 0===i?function(){return!!o()}:i,s="OK"===t?"onOk":"onCancel";n&&s in n&&("onOk"!==s||a())&&n[s](o())}},{key:"keyDown",value:function(t){var e=(0,f.default)(t),n=document.activeElement,r=n&&"TEXTAREA"===n.tagName;("Escape"===e||"Enter"===e&&!r)&&(this.exit("Enter"===e?"OK":"Cancel"),t.preventDefault()),t.stopPropagation()}},{key:"componentDidMount",value:function(){var t=this.base.querySelector(["input:not([type=checkbox]):not([type=button])","textarea","[contenteditable]","select"].join(","))||this.base.querySelector(["button.close"].join(","));console.assert(t,"No active buttons"),t.focus&&t.focus()}},{key:"componentWillUnmount",value:function(){(document.querySelector(".cliparea")||document.body).focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.children,o=e.title,i=e.params,a=void 0===i?{}:i,u=e.result,l=void 0===u?function(){return null}:u,f=e.valid,p=void 0===f?function(){return!!l()}:f,d=e.buttons,h=void 0===d?["Cancel","OK"]:d,m=r(e,["children","title","params","result","valid","buttons"]);return(0,c.h)("form",s({role:"dialog",onSubmit:function(t){return t.preventDefault()},onKeyDown:function(e){return t.keyDown(e)},tabIndex:"-1"},m),(0,c.h)("header",null,o,a.onCancel&&o&&(0,c.h)("button",{className:"close",onClick:function(){return t.exit("Cancel")}},"×")),n,(0,c.h)("footer",null,h.map(function(e){return"string"!=typeof e?e:(0,c.h)("input",{type:"button",value:e,disabled:"OK"===e&&!p(),onClick:function(){return t.exit(e)}})})))}}]),e}(c.Component);n.default=p},{preact:483,"w3c-keyname":513}],595:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function c(t){var e=t.labelPos,n=t.title,r=t.children,o=i(t,["labelPos","title","children"]);return(0,y.h)("label",o,n&&"after"!==e?n+":":"",r,n&&"after"===e?n:"")}function l(t,e){var n=e.customValid,r=e.serialize,o=void 0===r?{}:r,i=e.deserialize,a=void 0===i?{}:i,s=new b.default.Validator;return n&&(t=Object.assign({},t),t.properties=Object.keys(n).reduce(function(t,e){return s.customFormats[e]=n[e],t[e]=m({format:e},t[e]),t},t.properties)),{key:t.key||"",serialize:function(e){return s.validate(e,t,{rewrite:f.bind(null,o)})},deserialize:function(e){return s.validate(e,t,{rewrite:p.bind(null,a)})}}}function f(t,e,n){var r={};if("object"!==(void 0===e?"undefined":h(e))||!n.properties)return void 0!==e?e:n.default;for(var o in n.properties)n.properties.hasOwnProperty(o)&&o in e&&(r[o]=e[t[o]]||e[o]);return r}function p(t,e,n){return e}function d(t){var e={},n=void 0;return t.forEach(function(t){n=t.property.split(".")[1],e[n]||(e[n]=t.schema.invalidMessage||t.message)}),e}Object.defineProperty(n,"__esModule",{value:!0}),n.SelectOneOf=n.Field=n.Form=void 0;var h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},g=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),v=t("jsonschema"),b=r(v),y=t("preact"),_=t("preact-redux"),x=t("./input"),w=r(x),S=t("../state/form"),O=function(t){function e(t){var n=t.onUpdate,r=t.schema,o=t.init,u=i(t,["onUpdate","schema","init"]);a(this,e);var c=s(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));if(c.schema=l(r,u),o){var f=c.schema.serialize(o),p=f.valid,h=f.errors,m=d(h);o=Object.assign({},o,{init:!0}),n(o,p,m)}return c}return u(e,t),g(e,[{key:"updateState",value:function(t){var e=this.schema.serialize(t),n=e.instance,r=e.valid,o=e.errors,i=d(o);this.props.onUpdate(n,r,i)}},{key:"getChildContext",value:function(){return{schema:this.props.schema,stateStore:this}}},{key:"field",value:function(t,e){var n=this.props,r=n.result,i=n.errors,a=r[t],s=this;return{dataError:i&&i[t]||!1,value:a,onChange:function(n){var r=Object.assign({},s.props.result,o({},t,n));s.updateState(r),e&&e(n)}}}},{key:"render",value:function(t){var e=t.result,n=t.children,r=t.schema,o=i(t,["result","children","schema"]);return r.key&&r.key!==this.schema.key&&(this.schema=l(r,o),this.schema.serialize(e),this.updateState(e)),(0,y.h)("form",o,n)}}]),e}(y.Component);n.Form=O=(0,_.connect)(null,function(t){return{onUpdate:function(e,n,r){t((0,S.updateFormState)({result:e,valid:n,errors:r}))}}})(O);var A=function(t){function e(){return a(this,e),s(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,t),g(e,[{key:"render",value:function(t){var e=t.name,n=t.onChange,r=t.className,o=t.component,a=i(t,["name","onChange","className","component"]),s=this.context,u=s.schema,l=s.stateStore,f=a.schema||u.properties[e],p=l.field(e,n),d=p.dataError,h=i(p,["dataError"]);return(0,y.h)(c,{className:r,"data-error":d,title:a.title||f.title},o?(0,y.h)(o,m({},h,a)):(0,y.h)(w.default,m({name:e,schema:f},h,a)))}}]),e}(y.Component),E=function(t){var e=t.title,n=t.name,r=t.schema,o=i(t,["title","name","schema"]),a={title:e,enum:[],enumNames:[]};return Object.keys(r).forEach(function(t){a.enum.push(t),a.enumNames.push(r[t].title||t)}),(0,y.h)(A,m({name:n,schema:a},o))};n.Form=O,n.Field=A,n.SelectOneOf=E},{"../state/form":637,"./input":596,jsonschema:198,preact:483,"preact-redux":482}],596:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function s(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function u(t){var e=t.value,n=t.onChange,r=t.type,o=void 0===r?"text":r,i=s(t,["value","onChange","type"]);return(0,S.h)("input",w({type:o,value:e,onInput:n},i))}function c(t){var e=t.value,n=t.onChange,r=s(t,["value","onChange"]);return(0,S.h)("textarea",w({value:e,onInput:n},r))}function l(t){var e=t.value,n=t.onChange,r=s(t,["value","onChange"]);return(0,S.h)("input",w({type:"checkbox",checked:e,onClick:n},r))}function f(t){var e=t.schema,n=t.value,r=t.selected,o=t.onSelect,i=s(t,["schema","value","selected","onSelect"]);return(0,S.h)("select",w({onChange:o},i),d(e,function(t,e){return(0,S.h)("option",{selected:r(e,n),value:"object"!==(void 0===e?"undefined":x(e))&&e},t)}))}function p(t){var e=t.schema,n=t.value,r=t.selected,o=t.onSelect,i=t.type,a=void 0===i?"radio":i,u=s(t,["schema","value","selected","onSelect","type"]);return(0,S.h)("fieldset",{onClick:o,className:"radio"},d(e,function(t,e){return(0,S.h)("label",null,(0,S.h)("input",w({type:a,checked:r(e,n),value:"object"!==(void 0===e?"undefined":x(e))&&e},u)),t)}))}function d(t,e){var n=Array.isArray(t);if(!n&&t.items&&(t=t.items),"function"==typeof e)return(n?t:t.enum).map(function(r,o){var i=n?r.title:t.enumNames&&t.enumNames[o];return e(void 0!==i?i:r,void 0!==r.value?r.value:r)});if(!n)return t.enum[e];var r=t[e];return void 0!==r.value?r.value:r}function h(t,e,n){var r={};return e&&("number"!==e.type&&"integer"!==e.type||(r={type:"text"})),w({onChange:function(r){var o=t.val?t.val(r,e):r;n(o)}},r)}function m(t,e,n){return{selected:function(t,e){return e===t},onSelect:function(r,o){var i=t.val?t.val(r,e):r;void 0!==i&&n(i)}}}function g(t,e,n){return{multiple:!0,selected:function(t,e){return e&&e.indexOf(t)>=0},onSelect:function(r,o){if(t.val){var i=t.val(r,e);void 0!==i&&n(i)}else{var s=o?o.indexOf(r):-1;n(s<0?o?[r].concat(a(o)):[r]:[].concat(a(o.slice(0,s)),a(o.slice(s+1))))}}}}function v(t,e){var n=e.schema,r=e.multiple,o=e.onChange;return n&&(n.enum||n.items||Array.isArray(n))&&"string"!==n.type?r||"array"===n.type?g(t,n,o):m(t,n,o):h(t,n,o)}function b(t){var e=t.schema,n=t.type,r=t.multiple;return e&&(e.enum||e.items||Array.isArray(e))?r||"array"===e.type?"checkbox"===n?p:f:"radio"===n?p:f:"checkbox"===n||e&&"boolean"===e.type?l:"textarea"===n?c:u}function y(t,e){for(var n in t)if(!(n in e))return!0;for(var r in e)if(t[r]!==e[r])return!0;return!1}Object.defineProperty(n,"__esModule",{value:!0});var _=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},S=t("preact");u.val=function(t,e){var n=t.target,r="number"===n.type||"range"===n.type||e&&("number"===e.type||"integer"===e.type),o=r?n.value.replace(/,/g,"."):n.value;return r&&!isNaN(o-0)?o-0:o},c.val=function(t){return t.target.value},l.val=function(t){return t.stopPropagation(),!!t.target.checked},f.val=function(t,e){var n=t.target;return n.multiple?[].reduce.call(n.options,function(t,n,r){return n.selected?[d(e,r)].concat(a(t)):t},[]):d(e,n.selectedIndex)},p.val=function(t,e){var n=t.target;if("INPUT"!==t.target.tagName)return void t.stopPropagation();var r=n.parentNode.parentNode,o=[].reduce.call(r.querySelectorAll("input"),function(t,n,r){return n.checked?[d(e,r)].concat(a(t)):t},[]);return"radio"===n.type?o[0]:o};var O=function(t){function e(t){var n=t.component,i=s(t,["component"]);r(this,e);var a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,i));return a.component=n||b(i),a.ctrl=v(a.component,i),a}return i(e,t),_(e,[{key:"shouldComponentUpdate",value:function(t){var e=(t.children,t.onChange,s(t,["children","onChange"])),n=this.props;n.children,n.onChange;return y(s(n,["children","onChange"]),e)}},{key:"render",value:function(){var t=this.props,e=(t.children,t.onChange,s(t,["children","onChange"]));return(0,S.h)(this.component,w({},this.ctrl,e))}}]),e}(S.Component);n.default=O},{preact:483}],597:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e,n){return!t&&0!==t||isNaN(t)?null:"px"===n||"pt"===n?(t*h[e]/h[n]).toFixed()-0:(t*h[e]/h[n]).toFixed(3)-0}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t("preact"),f=t("./input"),p=function(t){return t&&t.__esModule?t:{default:t}}(f),d=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state={meas:"px"},n}return a(e,t),c(e,[{key:"handleChange",value:function(t,e){var n=s(t,this.state.meas,"px");this.state.cust=t,e(n)}},{key:"render",value:function(){var t=this,e=this.state,n=e.meas,o=e.cust,i=this.props,a=i.schema,c=i.value,f=i.onChange,d=r(i,["schema","value","onChange"]);return s(o,n,"px")!==c&&this.setState({meas:"px",cust:c}),(0,l.h)("div",u({style:"display: inline-flex;"},d),(0,l.h)(p.default,{schema:a,step:"px"===n||"pt"===n?"1":"0.001",style:"width: 75%;",value:o,onChange:function(e){return t.handleChange(e,f)}}),(0,l.h)(p.default,{schema:{enum:["cm","px","pt","inch"]},style:"width: 25%;",value:n,onChange:function(e){return t.setState({meas:e,cust:s(t.state.cust,t.state.meas,e)})}}))}}]),e}(l.Component),h={px:1,cm:37.795278,pt:1.333333,inch:96};n.default=d},{"./input":596,preact:483}],598:[function(t,e,n){(function(e){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){return new Promise(function(n,r){if(e.FileReader)n(u);else if(e.ActiveXObject)try{var o=new ActiveXObject("Scripting.FileSystemObject");n(function(t){return Promise.resolve(c(o,t))})}catch(t){r(t)}else t?n(t.then(function(){throw"Server doesn't still support echo method"})):r(new Error("Your browser does not support opening files locally"))})}function u(t){return new Promise(function(e,n){var r=new FileReader;r.onload=function(){var n=r.result;t.msClose&&t.msClose(),e(n)},r.onerror=function(t){n(t)},r.readAsText(t,"UTF-8")})}function c(t,e){var n=t.OpenTextFile(e.name,1),r=n.ReadAll();return n.Close(),r}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=t("preact"),p=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return t.server&&s(t.server).then(function(t){n.setState({opener:t})}),n}return a(e,t),l(e,[{key:"open",value:function(t){var e=t.target.files,n=function(){return null},r=this.props,o=r.onLoad,i=void 0===o?n:o,a=r.onError,s=void 0===a?n:a;this.state.opener&&e.length?this.state.opener(e[0]).then(i,s):e.length&&i(e[0]),t.target.value=null,t.preventDefault()}},{key:"render",value:function(){var t=this,e=this.props,n=e.children,o=e.type,i=r(e,["children","type"]);return(0,f.h)("div",i,(0,f.h)("input",{id:"input-file",onChange:function(e){return t.open(e)},accept:o,type:"file"}),(0,f.h)("label",{for:"input-file"},n))}}]),e}(f.Component);n.default=p}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{preact:483}],599:[function(t,e,n){(function(e){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){return new Promise(function(n,r){e.Blob&&p.default.saveAs?n(function(t,e,n){var r=new Blob([t],{type:n});p.default.saveAs(r,e)}):t?n(t.then(function(){throw"Server doesn't still support echo method"})):r(new Error("Your browser does not support opening files locally"))})}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t("preact"),f=t("filesaver.js"),p=function(t){return t&&t.__esModule?t:{default:t}}(f),d=function(t){function e(t){var n=t.filename,a=void 0===n?"unnamed":n,c=t.type,l=void 0===c?"text/plain":c,f=t.className,p=void 0===f?"":f,d=r(t,["filename","type","className"]);o(this,e);var h=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u({filename:a,type:l,className:p},d)));return s(d.server).then(function(t){h.setState({saver:t})}),h}return a(e,t),c(e,[{key:"save",value:function(t){var e=function(){return null},n=this.props,r=n.filename,o=n.data,i=n.type,a=n.onSave,s=void 0===a?e:a,u=n.onError,c=void 0===u?e:u;if(this.state.saver&&o)try{this.state.saver(o,r,i),s()}catch(t){c(t)}t.preventDefault()}},{key:"render",value:function(){var t=this,e=this.props,n=e.children,o=e.filename,i=e.data,a=e.className,s=r(e,["children","filename","data","className"]);return this.state.saver&&i||(a="disabled "+a),(0,l.h)("a",u({download:o,onClick:function(e){return t.save(e)},className:a},s),n)}}]),e}(l.Component);n.default=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"filesaver.js":192,preact:483}],600:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t){var e=t.schema,n=t.value,o=t.onSelect,s=t.splitIndexes,u=r(t,["schema","value","onSelect","splitIndexes"]);return(0,a.h)("ul",u,e.enum.map(function(t,r){return(0,a.h)("li",{onClick:function(){return o(t,r)},className:(t===n?"selected ":"")+(i(r,s)?"split":"")},e.enumNames?e.enumNames[r]:t)}))}function i(t,e){return t>0&&e&&e.includes(t)}Object.defineProperty(n,"__esModule",{value:!0});var a=t("preact");n.default=o},{preact:483}],601:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t){var e=r(t,[]);return(0,a.h)("div",i({className:"spinner"},e))}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=t("preact");n.default=o},{preact:483}],602:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.struct,o=e.tool,i=e.toolOpts,a=e.options;r!==n.struct&&t.struct(r),o===n.tool&&i===n.toolOpts||t.tool(o,i),n.options&&a!==n.options&&t.options(a);for(var s in t.event)if(t.event.hasOwnProperty(s)){var u="on"+(0,l.default)(s);e[u]!==n[u]&&(console.info("update editor handler",u),n[u]&&t.event[s].remove(n[u]),e[u]&&t.event[s].add(e[u]))}}Object.defineProperty(n,"__esModule",{value:!0});var c=t("lodash/fp/upperFirst"),l=r(c),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),d=t("preact"),h=t("../../editor"),m=r(h),g=function(t){function e(){return i(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return s(e,t),p(e,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentWillReceiveProps",value:function(t){u(this.instance,t,this.props)}},{key:"componentDidMount",value:function(){console.assert(this.base,"No backing element"),this.instance=new m.default(this.base,f({},this.props.options)),u(this.instance,this.props),this.props.onInit&&this.props.onInit(this.instance)}},{key:"render",value:function(){var t=this.props,e=t.Tag,n=void 0===e?"div":e,r=(t.struct,t.tool,t.toolOpts,t.options,o(t,["Tag","struct","tool","toolOpts","options"]));return(0,d.h)(n,f({onMouseDown:function(t){return t.preventDefault()}},r))}}]),e}(d.Component);n.default=g},{"../../editor":539,"lodash/fp/upperFirst":439,preact:483}],603:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t)if(e.prerender)t.innerHTML=e.prerender;else{console.info("render!",t.clientWidth,t.clientWidth);var r=new v.default(t,l({autoScale:!0},n));r.setMolecule(e),r.update()}}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f=t("preact"),p=t("../../chem/struct"),d=r(p),h=t("../../chem/molfile"),m=r(h),g=t("../../render"),v=r(g),b=function(t){function e(t){i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));if(!(t.struct instanceof d.default))try{n.props.struct=m.default.parse(t.struct)}catch(t){alert("Could not parse structure\n"+t),n.props.struct=null}return n}return s(e,t),c(e,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"componentDidMount",value:function(){var t=this.refs?this.refs.base:this.base,e=this.props;u(t,e.struct,e.options)}},{key:"render",value:function(){var t=this.props,e=t.struct,n=t.Tag,r=void 0===n?"div":n,i=o(t,["struct","Tag"]);return(0,f.h)(r,i,e?null:"No molecule")}}]),e}(f.Component);n.default=b},{"../../chem/molfile":519,"../../chem/struct":533,"../../render":565,preact:483}],604:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(){var t=v.map(function(t){return new h.default(t).check().then(function(){return t},function(){return null})});return Promise.all(t)}function c(t){return t.substring(t.indexOf("px ")+3)}Object.defineProperty(n,"__esModule",{value:!0});var l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}
}(),p=t("preact"),d=t("font-face-observer"),h=r(d),m=t("./input"),g=r(m),v=["Arial","Arial Black","Comic Sans MS","Courier New","Georgia","Impact","Charcoal","Lucida Console","Monaco","Palatino Linotype","Book Antiqua","Palatino","Tahoma","Geneva","Times New Roman","Times","Verdana","Symbol","MS Serif","MS Sans Serif","New York","Droid Sans","Droid Serif","Droid Sans Mono","Roboto"],b=null,y=function(t){function e(t){i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state={availableFonts:[c(t.value)]},n.setAvailableFonts(),n}return s(e,t),f(e,[{key:"setAvailableFonts",value:function(){var t=this;b?this.setState({availableFonts:b}):u().then(function(e){b=e.filter(function(t){return null!==t}),t.setState({availableFonts:b})})}},{key:"render",value:function(){var t=o(this.props,[]),e={enum:[],enumNames:[]};return this.state.availableFonts.forEach(function(t){e.enum.push("30px "+t),e.enumNames.push(t)}),1!==e.enum.length?(0,p.h)(g.default,l({schema:e},t)):(0,p.h)("select",null,(0,p.h)("option",null,e.enumNames[0]))}}]),e}(p.Component);n.default=y},{"./input":596,"font-face-observer":194,preact:483}],605:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=t("preact"),c=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state.tabIndex=t.tabIndex||0,n.props.changeTab(n.state.tabIndex),n}return a(e,t),s(e,[{key:"changeTab",value:function(t,e){this.setState({tabIndex:e}),this.props.changeTab&&this.props.changeTab(e)}},{key:"render",value:function(){var t=this,e=this.props,n=e.children,o=e.captions,i=r(e,["children","captions"]);return(0,u.h)("ul",i,(0,u.h)("li",{className:"tabs"},o.map(function(e,n){return(0,u.h)("a",{className:t.state.tabIndex===n?"active":"",onClick:function(e){return t.changeTab(e,n)}},e)})),(0,u.h)("li",{className:"tabs-content"},n[this.state.tabIndex]))}}]),e}(u.Component);n.default=c},{preact:483}],606:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=t("preact"),l=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.resize=function(t,e){var r=n.base.offsetHeight;n.state.height!==r&&n.setState({height:r}),e&&(n.setState({offset:0}),n.base.scrollTop=0)},n.handleScroll=function(){n.setState({offset:n.base.scrollTop}),n.props.sync&&n.forceUpdate()},n.state={offset:0,height:0},n}return a(e,t),u(e,[{key:"componentDidUpdate",value:function(t){var e=t.data,n=e.length===this.props.data.length&&this.props.data.every(function(t,n){return t===e[n]});this.resize(null,!n)}},{key:"componentDidMount",value:function(){this.resize(),addEventListener("resize",this.resize)}},{key:"componentWillUnmount",value:function(){removeEventListener("resize",this.resize)}},{key:"render",value:function(){var t=this.props,e=t.data,n=t.rowHeight,o=t.children,i=t.Tag,a=void 0===i?"div":i,u=t.overscanCount,l=void 0===u?1:u,f=(t.sync,r(t,["data","rowHeight","children","Tag","overscanCount","sync"])),p=this.state,d=p.offset,h=p.height,m=d/n||0,g=o[0],v=h/n||0;l&&(m=Math.max(0,m-m%l),v+=l);var b=m+1+v,y=e.slice(m,b);return(0,c.h)("div",s({onScroll:this.handleScroll},f),(0,c.h)("div",{style:"position:relative; overflow:hidden; width:100%; min-height:100%; height:"+e.length*n+"px;"},(0,c.h)(a,{style:"position:absolute; top:0; left:0; height:100%; width:100%; overflow:visible; top:"+m*n+"px;"},y.map(function(t,e){return g(t,m+e)}))))}}]),e}(c.Component);n.default=l},{preact:483}],607:[function(t,e,n){"use strict";function r(){return Object.keys(h.properties).reduce(function(t,e){return t[e]=h.properties[e].default,t},{})}function o(t){if("object"!==(void 0===t?"undefined":i(t))||null===t)return null;var e=new u.default.Validator,n=e.validate(t,h),r=n.errors,o=r.map(function(t){return t.property.split(".")[1]});return Object.keys(t).reduce(function(e,n){return h.properties[n]&&-1===o.indexOf(n)&&(e[n]=t[n]),e},{})}Object.defineProperty(n,"__esModule",{value:!0}),n.SERVER_OPTIONS=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.getDefaultOptions=r,n.validation=o;var s=t("jsonschema"),u=function(t){return t&&t.__esModule?t:{default:t}}(s),c={resetToSelect:{title:"Reset to Select Tool",enum:[!0,"paste",!1],enumNames:["on","After Paste","off"],default:"paste"},rotationStep:{title:"Rotation Step, º",type:"integer",minimum:1,maximum:90,default:15}},l={miewMode:{title:"Display mode",enum:["lines","balls and sticks","licorice"],enumNames:["Lines","Balls and Sticks","Licorice"],default:"lines"},miewTheme:{title:"Background color",enum:["light","dark"],enumNames:["Light","Dark"],default:"light"},miewAtomLabel:{title:"Label coloring",enum:["no","bright","inverse","black and white","black"],enumNames:["No","Bright","Inverse","Black and White","Black"],default:"bright"}},f={showValenceWarnings:{title:"Show valence warnings",type:"boolean",default:!0},atomColoring:{title:"Atom coloring",type:"boolean",default:!0},hideChiralFlag:{title:"Do not show the Chiral flag",type:"boolean",default:!1},font:{title:"Font",type:"string",default:"30px Arial"},fontsz:{title:"Font size",type:"integer",default:13,minimum:1,maximum:96},fontszsub:{title:"Sub font size",type:"integer",default:13,minimum:1,maximum:96},carbonExplicitly:{title:"Display carbon explicitly",type:"boolean",default:!1},showCharge:{title:"Display charge",type:"boolean",default:!0},showValence:{title:"Display valence",type:"boolean",default:!0},showHydrogenLabels:{title:"Show hydrogen labels",enum:["off","Hetero","Terminal","Terminal and Hetero","on"],default:"on"},aromaticCircle:{title:"Aromatic Bonds as circle",type:"boolean",default:!0},doubleBondWidth:{title:"Double bond width",type:"integer",default:6,minimum:1,maximum:96},bondThickness:{title:"Bond thickness",type:"integer",default:2,minimum:1,maximum:96},stereoBondWidth:{title:"Stereo (Wedge) bond width",type:"integer",default:6,minimum:1,maximum:96}},p={"smart-layout":{title:"Smart-layout",type:"boolean",default:!0},"ignore-stereochemistry-errors":{title:"Ignore stereochemistry errors",type:"boolean",default:!0},"mass-skip-error-on-pseudoatoms":{title:"Ignore pseudoatoms at mass",type:"boolean",default:!1},"gross-formula-add-rsites":{title:"Add Rsites at mass calculation",type:"boolean",default:!0}},d=(n.SERVER_OPTIONS=Object.keys(p),{showAtomIds:{title:"Show atom Ids",type:"boolean",default:!1},showBondIds:{title:"Show bonds Ids",type:"boolean",default:!1},showHalfBondIds:{title:"Show half bonds Ids",type:"boolean",default:!1},showLoopIds:{title:"Show loop Ids",type:"boolean",default:!1}}),h={title:"Settings",type:"object",required:[],properties:a({},c,f,l,p,d)};n.default=h},{jsonschema:198}],608:[function(t,e,n){"use strict";function r(t){return Object.keys(t)[0]}function o(t,e){return t||e?e?c[t][e]?c[t][e].properties.fieldValue.default:"":r(c[t]):r(c)}Object.defineProperty(n,"__esModule",{value:!0}),n.sdataSchema=n.sdataCustomSchema=void 0,n.getSdataDefault=o;var i=t("../utils"),a={enum:["Absolute","Relative","Attached"],default:"Absolute"},s={title:"Context",enum:["Fragment","Multifragment","Bond","Atom","Group"],default:"Fragment"},u={Fragment:{title:"Fragment",type:"Object",oneOf:[{key:"FRG_STR",title:"MDLBG_FRAGMENT_STEREO",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_FRAGMENT_STEREO"],default:"MDLBG_FRAGMENT_STEREO"},fieldValue:{title:"Field value",type:"array",items:{enum:["abs","(+)-enantiomer","(-)-enantiomer","racemate","steric","rel","R(a)","S(a)","R(p)","S(p)"]},default:["abs"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]},{key:"FRG_COEFF",title:"MDLBG_FRAGMENT_COEFFICIENT",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_FRAGMENT_COEFFICIENT"],default:"MDLBG_FRAGMENT_COEFFICIENT"},fieldValue:{title:"Field value",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field name"},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]},{key:"FRG_CHRG",title:"MDLBG_FRAGMENT_CHARGE",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_FRAGMENT_CHARGE"],default:"MDLBG_FRAGMENT_CHARGE"},fieldValue:{title:"Field value",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field name"},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]},{key:"FRG_RAD",title:"MDLBG_FRAGMENT_RADICALS",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_FRAGMENT_RADICALS"],default:"MDLBG_FRAGMENT_RADICALS"},fieldValue:{title:"Field value",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field name"},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]},Multifragment:{title:"Multifragment",type:"Object",oneOf:[{key:"MLT_FRG",title:"KETCHER_MULTIPLE_FRAGMENT",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["KETCHER_MULTIPLE_FRAGMENT"],default:"KETCHER_MULTIPLE_FRAGMENT"},fieldValue:{title:"Field value",type:"array",items:{enum:["aerosol","alloy","catenane","complex","composite","co-polymer","emulsion","host-guest complex","mixture","rotaxane","suspension"]},default:["aerosol"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]},Bond:{title:"Bond",type:"Object",oneOf:[{key:"SB_STR",title:"MDLBG_STEREO_KEY",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_STEREO_KEY"],default:"MDLBG_STEREO_KEY"},fieldValue:{title:"Field value",type:"array",items:{enum:["erythro","threo","alpha","beta","endo","exo","anti","syn","ECL","STG"]},default:["erythro"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]},{key:"SB_BND",title:"MDLBG_BOND_KEY",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_BOND_KEY"],default:"MDLBG_BOND_KEY"},fieldValue:{title:"Field value",type:"array",items:{enum:["Value=4"]},default:["Value=4"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]},Atom:{title:"Atom",type:"Object",oneOf:[{key:"AT_STR",title:"MDLBG_STEREO_KEY",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_STEREO_KEY"],default:"MDLBG_STEREO_KEY"},fieldValue:{title:"Field value",type:"array",items:{enum:["RS","SR","P-3","P-3-PI","SP-4","SP-4-PI","T-4","T-4-PI","SP-5","SP-5-PI","TB-5","TB-5-PI","OC-6","TP-6","PB-7","CU-8","SA-8","DD-8","HB-9","TPS-9"]},default:["RS"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]},Group:{title:"Group",type:"Object",oneOf:[{key:"GRP_STR",title:"MDLBG_STEREO_KEY",properties:{type:{enum:["DAT"]},fieldName:{title:"Field name",enum:["MDLBG_STEREO_KEY"],default:"MDLBG_STEREO_KEY"},fieldValue:{title:"Field value",type:"array",items:{enum:["cis","trans"]},default:["cis"]},radiobuttons:a},required:["fieldName","fieldValue","radiobuttons"]}]}},c=(n.sdataCustomSchema={key:"Custom",properties:{type:{enum:["DAT"]},context:{title:"Context",enum:["Fragment","Multifragment","Bond","Atom","Group"],default:"Fragment"},fieldName:{title:"Field name",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field name"},fieldValue:{title:"Field value",type:"string",default:"",minLength:1,invalidMessage:"Please, specify field value"},radiobuttons:{enum:["Absolute","Relative","Attached"],default:"Absolute"}},required:["context","fieldName","fieldValue","radiobuttons"]},n.sdataSchema=Object.keys(u).reduce(function(t,e){return t[e]=(0,i.mapOf)(u[e],"fieldName"),Object.keys(t[e]).forEach(function(n){return t[e][n].properties.context=s}),t},{}))},{"../utils":650}],609:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("../../chem/molfile"),o=function(t){return t&&t.__esModule?t:{default:t}}(r);n.default=["Benzene\n Ketcher 11161218352D 1 1.00000 0.00000 0\n\n 6 6 0 0 0 999 V2000\n 0.8660 2.0000 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.7320 1.5000 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.7320 0.5000 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.8660 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.0000 0.5000 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.0000 1.5000 0.0000 C 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0\n 2 3 2 0 0 0\n 3 4 1 0 0 0\n 4 5 2 0 0 0\n 5 6 1 0 0 0\n 6 1 2 0 0 0\nM END\n","Cyclopentadiene\n Ketcher 11161218352D 1 1.00000 0.00000 0\n\n 5 5 0 0 0 999 V2000\n 0.0000 1.4257 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.8090 0.8379 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.5000 -0.1132 0.0000 C 0 0 0 0 0 0 0 0 0\n -0.5000 -0.1132 0.0000 C 0 0 0 0 0 0 0 0 0\n -0.8090 0.8379 0.0000 C 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0\n 2 3 2 0 0 0\n 3 4 1 0 0 0\n 4 5 2 0 0 0\n 5 1 1 0 0 0\nM END\n","Cyclohexane\n Ketcher 11161218352D 1 1.00000 0.00000 0\n\n 6 6 0 0 0 999 V2000\n 0.8660 2.0000 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.7320 1.5000 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.7320 0.5000 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.8660 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.0000 0.5000 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.0000 1.5000 0.0000 C 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0\n 2 3 1 0 0 0\n 3 4 1 0 0 0\n 4 5 1 0 0 0\n 5 6 1 0 0 0\n 6 1 1 0 0 0\nM END\n","Cyclopentane\n Ketcher 11161218352D 1 1.00000 0.00000 0\n\n 5 5 0 0 0 999 V2000\n 0.8090 1.5389 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.6180 0.9511 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.3090 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.3090 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.0000 0.9511 0.0000 C 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0\n 2 3 1 0 0 0\n 3 4 1 0 0 0\n 4 5 1 0 0 0\n 5 1 1 0 0 0\nM END\n","Cyclopropane\n Ketcher 11161218352D 1 1.00000 0.00000 0\n\n 3 3 0 0 0 999 V2000\n -3.2250 -0.2750 0.0000 C 0 0 0 0 0 0 0 0 0\n -2.2250 -0.2750 0.0000 C 0 0 0 0 0 0 0 0 0\n -2.7250 0.5910 0.0000 C 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0\n 2 3 1 0 0 0\n 1 3 1 0 0 0\nM END\n","Cyclobutane\n Ketcher 11161218352D 1 1.00000 0.00000 0\n\n 4 4 0 0 0 999 V2000\n -3.8250 1.5500 0.0000 C 0 0 0 0 0 0 0 0 0\n -3.8250 0.5500 0.0000 C 0 0 0 0 0 0 0 0 0\n -2.8250 1.5500 0.0000 C 0 0 0 0 0 0 0 0 0\n -2.8250 0.5500 0.0000 C 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0\n 1 3 1 0 0 0\n 3 4 1 0 0 0\n 4 2 1 0 0 0\nM END\n","Cycloheptane\n Ketcher 11161218352D 1 1.00000 0.00000 0\n\n 7 7 0 0 0 999 V2000\n 0.0000 1.6293 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.7835 2.2465 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.7559 2.0242 0.0000 C 0 0 0 0 0 0 0 0 0\n 2.1897 1.1289 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.0000 0.6228 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.7566 0.2224 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.7835 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0\n 6 7 1 0 0 0\n 5 7 1 0 0 0\n 1 5 1 0 0 0\n 4 6 1 0 0 0\n 3 4 1 0 0 0\n 2 3 1 0 0 0\n 1 2 1 0 0 0\nM END\n","Cyclooctane\n Ketcher 11161218352D 1 1.00000 0.00000 0\n\n 8 8 0 0 0 999 V2000\n 0.0000 0.7053 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.0000 1.7078 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.7053 2.4131 0.0000 C 0 0 0 0 0 0 0 0 0\n 0.7056 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.7079 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0\n 2.4133 0.7053 0.0000 C 0 0 0 0 0 0 0 0 0\n 2.4133 1.7078 0.0000 C 0 0 0 0 0 0 0 0 0\n 1.7079 2.4131 0.0000 C 0 0 0 0 0 0 0 0 0\n 8 3 1 0 0 0\n 7 8 1 0 0 0\n 6 7 1 0 0 0\n 5 6 1 0 0 0\n 4 5 1 0 0 0\n 1 4 1 0 0 0\n 2 3 1 0 0 0\n 1 2 1 0 0 0\nM END\n"].map(function(t){return o.default.parse(t)})},{"../../chem/molfile":519}],610:[function(t,e,n){"use strict";function r(t){return(0,i.h)(u.default,{title:"About",className:"about",params:t,buttons:["Close"]},(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/ketcher/",target:"_blank"},(0,i.h)("img",{src:"images/ketcher-logo.svg"})),(0,i.h)("dl",null,(0,i.h)("dt",null,(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/ketcher/help.html",target:"_blank"},"Ketcher")),(0,i.h)("dd",null,"version ",(0,i.h)("var",null,t.version)),t.buildNumber?(0,i.h)("dd",null,"build #",(0,i.h)("var",null,t.buildNumber)," at ",(0,i.h)("time",null,t.buildDate)):null,t.indigoVersion?(0,i.h)("div",null,(0,i.h)("dt",null,(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/indigo/",target:"_blank"},"Indigo Toolkit")),(0,i.h)("dd",null,"version ",(0,i.h)("var",null,t.indigoVersion))):(0,i.h)("dd",null,"standalone"),(0,i.h)("dt",null,(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/",target:"_blank"},"EPAM Life Sciences")),(0,i.h)("dd",null,(0,i.h)("a",{href:"http://lifescience.opensource.epam.com/ketcher/#feedback",target:"_blank"},"Feedback"))))}Object.defineProperty(n,"__esModule",{value:!0});var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=t("preact"),a=t("preact-redux"),s=t("../component/dialog"),u=function(t){return t&&t.__esModule?t:{default:t}}(s);n.default=(0,a.connect)(function(t){return o({},t.options.app)})(r)},{"../component/dialog":594,preact:483,"preact-redux":482}],611:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){var e=t.value;return(0,g.h)("input",{type:"text",spellCheck:!1,value:e,onKeyDown:function(t){return f(t)}})}function c(t){return(0,g.h)("div",{className:"chem-input",spellCheck:!1,contentEditable:!0,onKeyDown:function(t){return f(t)}},t)}function l(t){var e=t.value;if(j.test(e))return c(e);for(var n,r=[],o=0;n=E.exec(e);)r.push(e.substring(o,n.index)+n[1]),n[2].length>0&&r.push((0,g.h)("sub",null,n[2])),o=n.index+n[0].length;return 0===o?r.push(e):r.push(e.substring(o,e.length)),c(r)}function f(t){var e=["Tab","ArrowLeft","ArrowRight","Home","End"],n=(0,y.default)(t);-1===e.indexOf(n)&&t.preventDefault()}function p(t,e){return"number"==typeof t?t.toFixed(e):t.replace(/[0-9]*\.[0-9]+/g,function(t){return(+t).toFixed(e)})}Object.defineProperty(n,"__esModule",{value:!0});var d=t("lodash/fp/range"),h=r(d),m=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),g=t("preact"),v=t("preact-redux"),b=t("w3c-keyname"),y=r(b),_=t("../component/dialog"),x=r(_),w=t("../component/input"),S=r(w),O=t("../state/options"),A=t("../state/server"),E=/\b([A-Z][a-z]{0,3})(\d*)\s*\b/g,j=/error:.*/g,P=function(t){function e(t){i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return t.onAnalyse(),n}return s(e,t),m(e,[{key:"render",value:function(){var t=this.props,e=t.values,n=t.round,r=(t.onAnalyse,t.onChangeRound),i=o(t,["values","round","onAnalyse","onChangeRound"]);return(0,g.h)(x.default,{title:"Calculated Values",className:"analyse",buttons:["Close"],params:i},(0,g.h)("ul",null,[{name:"Chemical Formula",key:"gross"},{name:"Molecular Weight",key:"molecular-weight",round:"roundWeight"},{name:"Exact Mass",key:"monoisotopic-mass",round:"roundMass"},{name:"Elemental Analysis",key:"mass-composition"}].map(function(t){return(0,g.h)("li",null,(0,g.h)("label",null,t.name,":"),"gross"===t.key?(0,g.h)(l,{value:e?e[t.key]:0}):(0,g.h)(u,{value:e?p(e[t.key],n[t.round]):0}),t.round?(0,g.h)(S.default,{schema:{enum:(0,h.default)(0,8),enumNames:(0,h.default)(0,8).map(function(t){return t+" decimal places"})},value:n[t.round],onChange:function(e){return r(t.round,e)}}):null)})))}}]),e}(g.Component);n.default=(0,v.connect)(function(t){return{values:t.options.analyse.values,round:{roundWeight:t.options.analyse.roundWeight,roundMass:t.options.analyse.roundMass}}},function(t){return{onAnalyse:function(){return t((0,A.analyse)())},onChangeRound:function(e,n){return t((0,O.changeRound)(e,n))}}})(P)},{"../component/dialog":594,"../component/input":596,"../state/options":641,"../state/server":643,"lodash/fp/range":436,preact:483,"preact-redux":482,"w3c-keyname":513}],612:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){var n=e.stateStore,r=n.props.result;return(0,f.h)("label",null,"Number:",(0,f.h)("input",{className:"number",type:"text",readOnly:!0,value:b.default.map[(0,c.default)(r.label)]||""}))}function a(t){var e=t.formState,n=o(t,["formState"]);return(0,f.h)(g.default,{title:"Atom Properties",className:"atom-props",result:function(){return e.result},valid:function(){return e.valid},params:n},(0,f.h)(h.Form,l({schema:d.atom,customValid:{label:function(t){return s(t)}},init:n},e),(0,f.h)("fieldset",{className:"main"},(0,f.h)(h.Field,{name:"label"}),(0,f.h)(h.Field,{name:"alias"}),(0,f.h)(i,null),(0,f.h)(h.Field,{name:"charge",maxlength:"5"}),(0,f.h)(h.Field,{name:"explicitValence"}),(0,f.h)(h.Field,{name:"isotope"}),(0,f.h)(h.Field,{name:"radical"})),(0,f.h)("fieldset",{className:"query"},(0,f.h)("legend",null,"Query specific"),(0,f.h)(h.Field,{name:"ringBondCount"}),(0,f.h)(h.Field,{name:"hCount"}),(0,f.h)(h.Field,{name:"substitutionCount"}),(0,f.h)(h.Field,{name:"unsaturatedAtom"})),(0,f.h)("fieldset",{className:"reaction"},(0,f.h)("legend",null,"Reaction flags"),(0,f.h)(h.Field,{name:"invRet"}),(0,f.h)(h.Field,{name:"exactChangeFlag"}))))}function s(t){return t&&!!b.default.map[(0,c.default)(t)]}Object.defineProperty(n,"__esModule",{value:!0});var u=t("lodash/fp/capitalize"),c=r(u),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f=t("preact"),p=t("preact-redux"),d=t("../structschema"),h=t("../component/form"),m=t("../component/dialog"),g=r(m),v=t("../../chem/element"),b=r(v);n.default=(0,p.connect)(function(t){return{formState:t.modal.form}})(a)},{"../../chem/element":516,"../component/dialog":594,"../component/form":595,"../structschema":648,"lodash/fp/capitalize":421,preact:483,"preact-redux":482}],613:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t){var e=t.formState,n=r(t,["formState"]);return(0,a.h)(f.default,{title:"Attachment Points",className:"attach-points",result:function(){return e.result},valid:function(){return e.valid},params:n},(0,a.h)(c.Form,i({schema:u.attachmentPoints,init:n},e),(0,a.h)(c.Field,{name:"primary"}),(0,a.h)(c.Field,{name:"secondary"})))}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=t("preact"),s=t("preact-redux"),u=t("../structschema"),c=t("../component/form"),l=t("../component/dialog"),f=function(t){return t&&t.__esModule?t:{default:t}}(l);n.default=(0,s.connect)(function(t){return{formState:t.modal.form}})(o)},{"../component/dialog":594,"../component/form":595,"../structschema":648,preact:483,"preact-redux":482}],614:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t){var e=t.formState,n=r(t,["formState"]);return(0,a.h)(l.default,{title:"Reaction Auto-Mapping",className:"automap",result:function(){return e.result},valid:function(){return e.valid},params:n},(0,a.h)(u.Form,i({schema:p},e),(0,a.h)(u.Field,{name:"mode"})))}Object.defineProperty(n,"__esModule",{value:!0}),n.automapSchema=void 0;var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=t("preact"),s=t("preact-redux"),u=t("../component/form"),c=t("../component/dialog"),l=function(t){return t&&t.__esModule?t:{default:t}}(c),f=t("../state/server"),p=n.automapSchema={title:"Reaction Auto-Mapping",type:"object",required:["mode"],properties:{mode:{title:"Mode",enum:["discard","keep","alter","clear"],enumNames:["Discard","Keep","Alter","Clear"],default:"discard"}}};n.default=(0,s.connect)(function(t){return{formState:t.modal.form}},function(t,e){return{onOk:function(n){t((0,f.automap)(n)),e.onOk(n)}}})(o)},{"../component/dialog":594,"../component/form":595,"../state/server":643,preact:483,"preact-redux":482}],615:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t){var e=t.formState,n=r(t,["formState"]);return(0,a.h)(f.default,{title:"Bond Properties",className:"bond",result:function(){return e.result},valid:function(){return e.valid},params:n},(0,a.h)(c.Form,i({schema:u.bond,init:n},e),(0,a.h)(c.Field,{name:"type"}),(0,a.h)(c.Field,{name:"topology"}),(0,a.h)(c.Field,{name:"center"})))}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=t("preact"),s=t("preact-redux"),u=t("../structschema"),c=t("../component/form"),l=t("../component/dialog"),f=function(t){return t&&t.__esModule?t:{default:t}}(l);n.default=(0,s.connect)(function(t){return{formState:t.modal.form}})(o)},{"../component/dialog":594,"../component/form":595,"../structschema":648,preact:483,"preact-redux":482}],616:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t){var e=v.properties.checkOptions.items;return e.enumNames[e.enum.indexOf(t)]}function a(t){var e=["Check","Settings"],n=t.formState,r=t.onCheck,i=o(t,["formState","onCheck"]),a=n.result,l=n.moleculeErrors;return(0,c.h)(p.default,{title:"Structure Check",className:"check",result:function(){return a},params:i},(0,c.h)(m.Form,u({schema:v},n),(0,c.h)(h.default,{className:"tabs",captions:e,changeTab:function(t){return 0===t?r(a.checkOptions):null}},(0,c.h)(s,{moleculeErrors:l}),(0,c.h)(m.Field,{name:"checkOptions",multiple:!0,type:"checkbox"}))))}function s(t){var e=t.moleculeErrors,n=Object.keys(e);return(0,c.h)("fieldset",t,0===n.length?(0,c.h)("dt",null,"No errors found"):n.map(function(t){return(0,c.h)("div",null,(0,c.h)("dt",null,i(t)," error :"),(0,c.h)("dd",null,e[t]))}))}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=t("preact"),l=t("preact-redux"),f=t("../component/dialog"),p=r(f),d=t("../component/tabs"),h=r(d),m=t("../component/form"),g=t("../state/server"),v={title:"Check",type:"object",properties:{checkOptions:{type:"array",items:{type:"string",enum:["valence","radicals","pseudoatoms","stereo","query","overlapping_atoms","overlapping_bonds","rgroups","chiral","3d"],enumNames:["Valence","Radical","Pseudoatom","Stereochemistry","Query","Overlapping Atoms","Overlapping Bonds","R-Groups","Chirality","3D Structure"]}}}};n.default=(0,l.connect)(function(t){return{formState:t.modal.form}},function(t){return{onCheck:function(e){return t((0,g.check)(e))}}})(a)},{"../component/dialog":594,"../component/form":595,"../component/tabs":605,"../state/server":643,preact:483,"preact-redux":482}],617:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t){
var e=t.labels,n=t.caption,o=void 0===n?"":n,i=t.selected,a=t.onSelect,s=r(t,["labels","caption","selected","onSelect"]);return(0,u.h)("fieldset",s,e.map(function(t){return(0,u.h)("button",{onClick:function(e){return a(t)},className:i(t)?"selected":""},t)}),o?(0,u.h)("legend",null,o):null)}function i(t){var e=t.gen,n=t.name,r=t.path,a=t.selected,s=t.onSelect,c=e[n],l=r?r+"/"+n:n,p=f[l];return p&&p.caption?(0,u.h)("fieldset",{className:n},(0,u.h)("legend",null,p.caption),c.labels?(0,u.h)(o,{labels:c.labels,selected:a,onSelect:s}):null,p.order.map(function(t){return(0,u.h)(i,{gen:c,name:t,path:l,selected:a,onSelect:s})})):(0,u.h)(o,{labels:c.labels,caption:p||n,className:n,selected:a,onSelect:s})}function a(t){var e=t.selected,n=t.onSelect,o=r(t,["selected","onSelect"]);return(0,u.h)("div",s({summary:"Generic Groups"},o),(0,u.h)("div",{className:"col"},(0,u.h)(i,{gen:l.default,name:"atom",selected:function(t){return e(t)},onSelect:function(t){return n(t)}}),(0,u.h)(i,{gen:l.default,name:"special",selected:function(t){return e(t)},onSelect:function(t){return n(t)}})),(0,u.h)("div",{className:"col"},(0,u.h)(i,{gen:l.default,name:"group",selected:function(t){return e(t)},onSelect:function(t){return n(t)}})))}Object.defineProperty(n,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=t("preact"),c=t("../../chem/generics"),l=function(t){return t&&t.__esModule?t:{default:t}}(c),f={atom:{caption:"Atom Generics",order:["any","no-carbon","metal","halogen"]},group:{caption:"Group Generics",order:["acyclic","cyclic"]},special:{caption:"Special Nodes",order:[]},"group/acyclic":{caption:"Acyclic",order:["carbo","hetero"]},"group/cyclic":{caption:"Cyclic",order:["no-carbon","carbo","hetero"]},"group/acyclic/carbo":{caption:"Carbo",order:["alkynyl","alkyl","alkenyl"]},"group/acyclic/hetero":{caption:"Hetero",order:["alkoxy"]},"group/cyclic/carbo":{caption:"Carbo",order:["aryl","cycloalkyl","cycloalkenyl"]},"group/cyclic/hetero":{caption:"Hetero",order:["aryl"]},"atom/any":"any atom","atom/no-carbon":"except C or H","atom/metal":"any metal","atom/halogen":"any halogen","group/cyclic/no-carbon":"no carbon","group/cyclic/hetero/aryl":"hetero aryl"};n.default=a},{"../../chem/generics":517,preact:483}],618:[function(t,e,n){"use strict";function r(t){return(0,o.h)(a.default,{title:"Help",className:"help",params:t,buttons:["Close"]},(0,o.h)("iframe",{className:"help",src:"doc/help.html"}))}Object.defineProperty(n,"__esModule",{value:!0});var o=t("preact"),i=t("../component/dialog"),a=function(t){return t&&t.__esModule?t:{default:t}}(i);n.default=r},{"../component/dialog":594,preact:483}],619:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(n,"__esModule",{value:!0});var o=t("./open"),i=r(o),a=t("./save"),s=r(a),u=t("./analyse"),c=r(u),l=t("./recognize"),f=r(l),p=t("./period-table"),d=r(p),h=t("./rgroup"),m=r(h),g=t("./template-attach"),v=r(g),b=t("./template-lib"),y=r(b),_=t("./about"),x=r(_),w=t("./help"),S=r(w),O=t("./miew"),A=r(O),E=t("./atom"),j=r(E),P=t("./attach"),T=r(P),C=t("./automap"),R=r(C),N=t("./bond"),k=r(N),I=t("./check"),B=r(I),M=t("./labeledit"),L=r(M),D=t("./rgroup-logic"),F=r(D),G=t("./options"),z=r(G),U=t("./sgroup"),W=r(U),H=t("./sdata"),V=r(H);n.default={open:i.default,save:s.default,analyse:c.default,recognize:f.default,"period-table":d.default,rgroup:m.default,attach:v.default,templates:y.default,about:x.default,help:S.default,miew:A.default,atomProps:j.default,attachmentPoints:T.default,automap:R.default,bondProps:k.default,check:B.default,labelEdit:L.default,rgroupLogic:F.default,settings:z.default,sgroup:W.default,sdata:V.default}},{"./about":610,"./analyse":611,"./atom":612,"./attach":613,"./automap":614,"./bond":615,"./check":616,"./help":618,"./labeledit":620,"./miew":621,"./open":622,"./options":623,"./period-table":624,"./recognize":625,"./rgroup":627,"./rgroup-logic":626,"./save":628,"./sdata":629,"./sgroup":630,"./template-attach":631,"./template-lib":632}],620:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t){var e=Math.abs(t.charge),n=["",":",".","^^"][t.radical]||"",r="";return e&&(r=t.charge<0?"-":"+"),(t.isotope||"")+t.label+n+(e>1?e:"")+r}function a(t){var e=t.match(/^(\d+)?([a-z*]{1,3})(\.|:|\^\^)?(\d+[-+]|[-+])?$/i);if(e){var n="*"===e[2]?"A":(0,c.default)(e[2]),r=0,o=0,i=0;if(e[1]&&(o=parseInt(e[1])),e[3]&&(i={":":1,".":2,"^^":3}[e[3]]),e[4]&&(r=parseInt(e[4]),isNaN(r)&&(r=1),e[4].endsWith("-")&&(r=-r)),"A"===n||"Q"===n||"X"===n||"M"===n||h.default.map[n])return{label:n,charge:r,isotope:o,radical:i}}return null}function s(t){var e={label:t.letter||i(t)},n=t.formState,r=o(t,["formState"]),s=n.result,u=n.valid;return(0,f.h)(g.default,{title:"Label Edit",className:"labeledit",valid:function(){return u},result:function(){return a(s.label)},params:r},(0,f.h)(v.Form,l({schema:b,customValid:{label:function(t){return a(t)}},init:e},n),(0,f.h)(v.Field,{name:"label",maxlength:"20",size:"10"})))}Object.defineProperty(n,"__esModule",{value:!0}),n.labelEditSchema=void 0;var u=t("lodash/fp/capitalize"),c=r(u),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f=t("preact"),p=t("preact-redux"),d=t("../../chem/element"),h=r(d),m=t("../component/dialog"),g=r(m),v=t("../component/form"),b=n.labelEditSchema={title:"Label Edit",type:"object",required:["label"],properties:{label:{title:"Atom",default:""}}};n.default=(0,p.connect)(function(t){return{formState:t.modal.form}})(s)},{"../../chem/element":516,"../component/dialog":594,"../component/form":595,"lodash/fp/capitalize":421,preact:483,"preact-redux":482}],621:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(){var t=_.storage.getItem("ketcher-opts");if(!t)return x;var e=x;return t.miewTheme&&(e.settings.theme=(0,d.default)(t.miewTheme)),t.miewAtomLabel&&(e.settings.atomLabel=(0,d.default)(t.miewAtomLabel)),t.miewMode&&(e.reps[0].mode=S[(0,d.default)(t.miewMode)]),e}function u(t){var e=t;return e.href||(e=document.createElement("a"),e.href=t),e.origin?e.origin:(e.hostname||(e=document.location),e.protocol+"//"+e.hostname+(e.port?":"+e.port:""))}function c(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&";return Array.isArray(t)?t.reduce(function(t,e){var n=c(e);return null!==n&&t.push(n),t},[]).join(e):"object"===(void 0===t?"undefined":g(t))?Object.keys(t).reduce(function(e,n){var r=t[n];return e.push("object"===(void 0===r?"undefined":g(r))?c(r):encodeURIComponent(n)+"="+encodeURIComponent(r)),e},[]).join(e):null}function l(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(r,o){addEventListener("message",function o(i){if(i.origin===u(e)&&"miewLoadComplete"===i.data){window.removeEventListener("message",o);var a=t.MIEWS[0];a._opts.load=!1,a._menuDisabled=!0,a.init()&&(a.setOptions(n),a.benchmarkGfx().then(function(){a.run(),setTimeout(function(){return r(a)},10)}))}})})}function f(t,e){return t.saveData(),new Promise(function(t,n){addEventListener("message",function n(r){r.origin===u(e)&&r.data.startsWith("CML:")&&(window.removeEventListener("message",n),t(atob(r.data.slice(4))))})})}Object.defineProperty(n,"__esModule",{value:!0});var p=t("lodash/fp/camelCase"),d=r(p),h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},m=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v=t("preact"),b=t("../component/dialog"),y=r(b),_=t("../utils"),x={preset:"small",settings:{theme:"light",atomLabel:"bright",autoPreset:!1,inversePanning:!0},reps:[{mode:"LN",colorer:"AT",selector:"all"}]},w={location:"no",menubar:"no",toolbar:"no",directories:"no",modal:"yes",alwaysRaised:"yes"},S={lines:"LN",ballsAndSticks:"BS",licorice:"LC"},O=function(t){function e(t){o(this,e),console.info("init");var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.opts=s(),n}return a(e,t),m(e,[{key:"load",value:function(t){var e=this,n=l(t.target.contentWindow,"",this.opts);this.setState({miew:n}),this.state.miew.then(function(t){t.parse(e.props.structStr,{fileType:"cml",loaded:!0}),e.setState({miew:t})})}},{key:"save",value:function(t){var e=this;if(this.props.onOk){var n=f(this.state.miew,"");this.setState({structStr:n}),this.state.structStr.then(function(t){e.props.onOk({structStr:t})})}}},{key:"window",value:function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(){var t=h({},this.opts,{load:"CML:"+btoa(this.props.structStr),sourceType:"message"}),e=this.base.getBoundingClientRect(),n=h({},w,{top:Math.round(e.top),left:Math.round(e.left),width:Math.round(e.width),height:Math.round(e.height)}),r=window.open("?"+c(t),"miew",c(n,","));r&&(this.props.onCancel&&this.props.onCancel(),r.onload=function(){console.info("windowed")})})},{key:"render",value:function(t){var e=this,n=this.state,r=n.miew,o=n.structStr;return(0,v.h)(y.default,{title:"3D View",className:"miew",params:t,buttons:["Close",(0,v.h)("button",{disabled:r instanceof Promise||o instanceof Promise,onClick:function(t){return e.save(t)}},"Apply"),(0,v.h)("button",{className:"window",disabled:/MSIE|rv:11/i.test(navigator.userAgent),onClick:function(t){return e.window()}},"Detach to new window")]},(0,v.h)("iframe",{id:"miew-iframe",src:"",onLoad:function(t){return e.load(t)}}))}}]),e}(v.Component);n.default=O},{"../component/dialog":594,"../utils":650,"lodash/fp/camelCase":420,preact:483}],622:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(){return Object.keys(p.map).reduce(function(t,e){return t.concat.apply(t,[p.map[e].mime].concat(o(p.map[e].ext)))},[]).join(",")}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t("preact"),f=t("preact-redux"),p=t("../structformat"),d=t("../component/dialog"),h=r(d),m=t("../component/openbutton"),g=r(m),v=t("../component/cliparea"),b=r(v),y=t("../state"),_=function(t){function e(t){i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state={structStr:"",fragment:!1},n}return s(e,t),c(e,[{key:"result",value:function(){var t=this.state,e=t.structStr,n=t.fragment;return e?{structStr:e,fragment:n}:null}},{key:"changeStructStr",value:function(t){this.setState({structStr:t})}},{key:"changeFragment",value:function(t){this.setState({fragment:t.checked})}},{key:"render",value:function(){var t=this,e=this.state,n=e.structStr,r=e.fragment;return(0,l.h)(h.default,{title:"Open Structure",className:"open",result:function(){return t.result()},params:this.props,buttons:[(0,l.h)(g.default,{className:"open",server:this.props.server,type:u(),onLoad:function(e){return t.changeStructStr(e)}},"Open From File…"),"Cancel","OK"]},(0,l.h)("textarea",{value:n,onInput:function(e){return t.changeStructStr(e.target.value)}}),(0,l.h)("label",null,(0,l.h)("input",{type:"checkbox",checked:r,onClick:function(e){return t.changeFragment(e.target)}}),"Load as a fragment and copy to the Clipboard"),(0,l.h)(b.default,{focused:function(){return!0},onCopy:function(){return{"text/plain":n}}}))}}]),e}(l.Component);n.default=(0,f.connect)(function(t){return{server:t.server}},function(t,e){return{onOk:function(n){n.fragment&&(0,v.exec)("copy"),t((0,y.load)(n.structStr,{badHeaderRecover:!0,fragment:n.fragment})),e.onOk(n)}}})(_)},{"../component/cliparea":592,"../component/dialog":594,"../component/openbutton":598,"../state":639,"../structformat":647,preact:483,"preact-redux":482}],623:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t){var e=t.initState,n=t.formState,r=t.server,i=t.onOpenFile,l=t.onReset,f=t.appOpts,p=o(t,["initState","formState","server","onOpenFile","onReset","appOpts"]),d=["Rendering customization options","Atoms","Bonds","Server","3D Viewer","Options for debugging"],v={0:!0,1:!1,2:!1,3:!1,4:!1,5:!1};return(0,c.h)(b.default,{title:"Settings",className:"settings",result:function(){return n.result},valid:function(){return n.valid},params:p,buttons:[(0,c.h)(E.default,{className:"open",server:r,onLoad:i},"Open From File…"),(0,c.h)(O.default,{className:"save",data:JSON.stringify(n.result),filename:"ketcher-settings"},"Save To File…"),(0,c.h)("button",{onClick:l},"Reset"),"OK","Cancel"]},(0,c.h)(m.Form,u({schema:h.default,init:e},n),(0,c.h)(_.default,{className:"accordion",captions:d,active:v},(0,c.h)("fieldset",{className:"render"},(0,c.h)(m.Field,{name:"resetToSelect"}),(0,c.h)(m.Field,{name:"rotationStep"}),(0,c.h)(a,{name:"showValenceWarnings"}),(0,c.h)(a,{name:"atomColoring"}),(0,c.h)(a,{name:"hideChiralFlag"}),(0,c.h)(m.Field,{name:"font",component:w.default}),(0,c.h)(s,{name:"fontsz"}),(0,c.h)(s,{name:"fontszsub"})),(0,c.h)("fieldset",{className:"atoms"},(0,c.h)(a,{name:"carbonExplicitly"}),(0,c.h)(a,{name:"showCharge"}),(0,c.h)(a,{name:"showValence"}),(0,c.h)(m.Field,{name:"showHydrogenLabels"})),(0,c.h)("fieldset",{className:"bonds"},(0,c.h)(a,{name:"aromaticCircle"}),(0,c.h)(s,{name:"doubleBondWidth"}),(0,c.h)(s,{name:"bondThickness"}),(0,c.h)(s,{name:"stereoBondWidth"})),(0,c.h)("fieldset",{className:"server",disabled:!f.server},(0,c.h)(a,{name:"smart-layout"}),(0,c.h)(a,{name:"ignore-stereochemistry-errors"}),(0,c.h)(a,{name:"mass-skip-error-on-pseudoatoms"}),(0,c.h)(a,{name:"gross-formula-add-rsites"})),(0,c.h)("fieldset",{className:"3dView",disabled:!f.miewPath},(0,c.h)(m.Field,{name:"miewMode"}),(0,c.h)(m.Field,{name:"miewTheme"}),(0,c.h)(m.Field,{name:"miewAtomLabel"})),(0,c.h)("fieldset",{className:"debug"},(0,c.h)(a,{name:"showAtomIds"}),(0,c.h)(a,{name:"showBondIds"}),(0,c.h)(a,{name:"showHalfBondIds"}),(0,c.h)(a,{name:"showLoopIds"}))),g.storage.isAvailable()?null:(0,c.h)("div",{className:"warning"},g.storage.warningMessage)))}function a(t,e){var n=e.schema,r={title:n.properties[t.name].title,enum:[!0,!1],enumNames:["on","off"]};return(0,c.h)(m.Field,u({schema:r},t))}function s(t,e){var n=e.schema;return(0,c.h)(m.Field,u({schema:n.properties[t.name],component:P.default},t))}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=t("preact"),l=t("preact-redux"),f=t("../state/form"),p=t("../state/options"),d=t("../data/options-schema"),h=r(d),m=t("../component/form"),g=t("../utils"),v=t("../component/dialog"),b=r(v),y=t("../component/accordion"),_=r(y),x=t("../component/systemfonts"),w=r(x),S=t("../component/savebutton"),O=r(S),A=t("../component/openbutton"),E=r(A),j=t("../component/measure-input"),P=r(j);n.default=(0,l.connect)(function(t){return{appOpts:t.options.app,initState:t.options.settings,formState:t.modal.form}},function(t,e){return{onOpenFile:function(e){try{t((0,f.updateFormState)({result:JSON.parse(e)}))}catch(t){console.info("Bad file")}},onReset:function(){return t((0,f.setDefaultSettings)())},onOk:function(n){t((0,p.saveSettings)(n)),e.onOk(n)}}})(i)},{"../component/accordion":589,"../component/dialog":594,"../component/form":595,"../component/measure-input":597,"../component/openbutton":598,"../component/savebutton":599,"../component/systemfonts":604,"../data/options-schema":607,"../state/form":637,"../state/options":641,"../utils":650,preact:483,"preact-redux":482}],624:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function u(){return(0,b.h)("tr",null,(0,m.default)(0,19).map(function(t){return(0,b.h)("th",null,t||"")}))}function c(t){var e=t.value,n=t.onChange,r=s(t,["value","onChange"]);return(0,b.h)("fieldset",null,k.map(function(t){return(0,b.h)("label",null,(0,b.h)("input",v({type:"radio",value:t.value,checked:t.value===e,onClick:function(e){return n(t.value)}},r)),t.title)}))}function l(t){var e=t.row,n=t.caption,r=t.refer,o=t.selected,i=t.onSelect,a=t.curEvents;return(0,b.h)("tr",null,(0,b.h)("th",null,n),e.map(function(t){return"number"!=typeof t?(0,b.h)("td",null,(0,b.h)(A.default,v({el:t,className:o(t.label)?"selected":"",onClick:function(e){return i(t.label)}},a(t)))):r(t)?(0,b.h)("td",{className:"ref"},r(t)):(0,b.h)("td",{colspan:t})}))}function f(t){var e=t.row,n=t.caption,r=t.selected,o=t.onSelect,i=t.curEvents;return(0,b.h)("tr",null,(0,b.h)("th",{colspan:"3",className:"ref"},n),e.map(function(t){return(0,b.h)("td",null,(0,b.h)(A.default,v({el:t,className:r(t.label)?"selected":"",onClick:function(e){return o(t.label)}},i(t))))}),(0,b.h)("td",null))}function p(t){var e=t.el,n=t.isInfo,r={color:e.color||"black","font-size":"1.2em"},o={color:e.color||"black","font-weight":"bold","font-size":"2em"};return(0,b.h)("div",{className:"atom-info "+(n?"":"none")},(0,b.h)("div",{style:r},x.default.map[e.label]),(0,b.h)("span",{style:o},e.label),(0,b.h)("br",null),e.title,(0,b.h)("br",null),e.atomic_mass)}function d(t){var e=t.selection();if(e&&1===Object.keys(e).length&&e.atoms&&1===Object.keys(e.atoms).length){var n=t.struct(),r=n.atoms.get(e.atoms[0]);return v({},(0,C.fromElement)(r))}return{}}Object.defineProperty(n,"__esModule",{value:!0});var h=t("lodash/fp/range"),m=r(h),g=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),v=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},b=t("preact"),y=t("preact-redux"),_=t("../../chem/element"),x=r(_),w=t("../component/dialog"),S=r(w),O=t("../component/atom"),A=r(O),E=t("../component/tabs"),j=r(E),P=t("./generic-groups"),T=r(P),C=t("../structconv"),R=t("../state"),N=t("../state/toolbar"),k=[{title:"Single",value:"atom"},{title:"List",value:"list"},{title:"Not List",value:"not-list"}],I={He:16,B:10,Al:10,Hf:1,Rf:1},B=function(t){return t.reduce(function(t,e){var n=t[e.period-1];return n?(I[e.label]&&n.push(I[e.label]),n.push(e)):t.push([e]),t},[])}(x.default.filter(function(t){return t&&"actinide"!==t.type&&"lanthanide"!==t.type})),M=x.default.filter(function(t){return t&&"lanthanide"===t.type}),L=x.default.filter(function(t){return t&&"actinide"===t.type}),D=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));n.curEvents=function(t){return{onMouseEnter:function(){return n.setState({cur:t,isInfo:!0})},onMouseLeave:function(){return n.setState({isInfo:!1})}}};var r=n.props.pseudo?"gen":null;return n.state={type:t.type||r||"atom",value:t.values||t.label||null,cur:x.default[2],isInfo:!1},n.firstType=!0,n}return a(e,t),g(e,[{key:"changeType",value:function(t){if(this.firstType)return this.firstType=!1;var e="list"===this.state.type||"not-list"===this.state.type;"list"!==t&&"not-list"!==t||!e?this.setState({type:t,value:"atom"===t||"gen"===t?null:[]}):this.setState({type:t})}},{key:"selected",value:function(t){var e=this.state,n=e.type,r=e.value;return"atom"===n||"gen"===n?r===t:r.includes(t)}},{key:"onSelect",value:function(t){var e=this.state,n=e.type,r=e.value;if("atom"===n||"gen"===n)this.setState({value:t});else{var o=r.indexOf(t);o<0?r.push(t):r.splice(o,1),this.setState({value:r})}}},{key:"result",value:function(){var t=this.state,e=t.type,n=t.value;return"atom"===e?n?{label:n,pseudo:null}:null:"gen"===e?n?{type:e,label:n,pseudo:n}:null:n.length?{type:e,values:n}:null}},{key:"render",value:function(){var t=this,e=["Table","Extended"],n=this.state.type;return(0,b.h)(S.default,{title:"Periodic table",className:"elements-table",params:this.props,result:function(){return t.result()}},(0,b.h)(j.default,{className:"tabs",captions:e,tabIndex:"gen"!==n?0:1,changeTab:function(e){return t.changeType(0===e?"atom":"gen")}},(0,b.h)("div",{className:"period-table"},(0,b.h)("table",{summary:"Periodic table of the chemical elements"},(0,b.h)(u,null),(0,b.h)(p,{el:this.state.cur,isInfo:this.state.isInfo}),B.map(function(e,n){return(0,b.h)(l,{row:e,caption:n+1,refer:function(t){return 1===t&&(5===n?"*":"**")},curEvents:t.curEvents,selected:function(e){return t.selected(e)},onSelect:function(e){return t.onSelect(e)}})}),(0,b.h)(f,{row:M,caption:"*",curEvents:this.curEvents,selected:function(e){return t.selected(e)},onSelect:function(e){return t.onSelect(e)}}),(0,b.h)(f,{row:L,caption:"**",curEvents:this.curEvents,selected:function(e){return t.selected(e)},onSelect:function(e){return t.onSelect(e)}})),(0,b.h)(c,{value:n,onChange:function(e){return t.changeType(e)}})),(0,b.h)(T.default,{className:"generic-groups",selected:this.selected.bind(this),onSelect:this.onSelect.bind(this)})))}}]),e}(b.Component);n.default=(0,y.connect)(function(t,e){return e.values||e.label?{}:d(t.editor)},function(t,e){return{onOk:function(n){n.type&&"atom"!==n.type||t((0,N.addAtoms)(n.label)),t((0,R.onAction)({tool:"atom",opts:(0,C.toElement)(n)})),e.onOk(n)}}})(D)},{"../../chem/element":516,"../component/atom":591,"../component/dialog":594,"../component/tabs":605,"../state":639,"../state/toolbar":645,"../structconv":646,"./generic-groups":617,"lodash/fp/range":436,preact:483,"preact-redux":482}],625:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t){var e=t.file,n=t.structStr,r=t.fragment,i=t.onRecognize,u=t.isFragment,c=t.onImage,l=o(t,["file","structStr","fragment","onRecognize","isFragment","onImage"]),f=function(){return!n||n instanceof Promise?null:{structStr:n,fragment:r}};return(0,s.h)(d.default,{title:"Import From Image",className:"recognize",params:l,result:function(){return f()},buttons:[(0,s.h)(y.default,{className:"open",onLoad:c,type:"image/*"},"Choose file…"),(0,s.h)("span",{className:"open-filename"},e?e.name:null),e&&!n?(0,s.h)("button",{onClick:function(){return i(e)}},"Recognize"):null,"Cancel","OK"]},(0,s.h)("div",{className:"picture"},e?(0,s.h)("img",{id:"pic",src:a(e)||"",onError:function(){c(null),alert("Error, it isn't a picture")}}):null),(0,s.h)("div",{className:"output"},n?n instanceof Promise||"string"!=typeof n?(0,s.h)(x.default,null):(0,s.h)(v.default,{className:"struct",struct:n}):null),(0,s.h)("label",null,(0,s.h)(m.default,{type:"checkbox",value:r,onChange:function(t){return u(t)}}),"Load as a fragment"))}function a(t){if(!t)return null;var e=window.URL||window.webkitURL;return e?e.createObjectURL(t):"No preview"}Object.defineProperty(n,"__esModule",{value:!0});var s=t("preact"),u=t("preact-redux"),c=t("../state/options"),l=t("../state"),f=t("../state/server"),p=t("../component/dialog"),d=r(p),h=t("../component/input"),m=r(h),g=t("../component/structrender"),v=r(g),b=t("../component/openbutton"),y=r(b),_=t("../component/spin"),x=r(_);n.default=(0,u.connect)(function(t){return{file:t.options.recognize.file,structStr:t.options.recognize.structStr,fragment:t.options.recognize.fragment}},function(t,e){return{isFragment:function(e){return t((0,c.shouldFragment)(e))},onImage:function(e){return t((0,c.changeImage)(e))},onRecognize:function(e){return t((0,f.recognize)(e))},onOk:function(n){t((0,l.load)(n.structStr,{rescale:!0,fragment:n.fragment})),e.onOk(n)}}})(i)},{"../component/dialog":594,"../component/input":596,"../component/openbutton":598,"../component/spin":601,"../component/structrender":603,"../state":639,"../state/options":641,"../state/server":643,preact:483,"preact-redux":482}],626:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){var n=e.schema,r=t.name,o=t.rgids,i={title:n.properties[r].title,enum:[0],enumNames:["Always"]};return o.forEach(function(e){t.label!==e&&(i.enum.push(e),i.enumNames.push("IF R"+t.label+" THEN R"+e))}),(0,u.h)(f.Field,s({name:r,schema:i},t))}function i(t){var e=t.formState,n=t.label,i=t.rgroupLabels,c=r(t,["formState","label","rgroupLabels"]);return(0,u.h)(d.default,{title:"R-Group Logic",className:"rgroup-logic",result:function(){return e.result},valid:function(){return e.valid},params:c},(0,u.h)(f.Form,s({schema:l.rgroup,customValid:{range:function(t){return a(t)}},init:c},e),(0,u.h)(f.Field,{name:"range"}),(0,u.h)(f.Field,{name:"resth"}),(0,u.h)(o,{name:"ifthen",className:"cond",label:n,rgids:i})))}function a(t){return t.replace(/\s*/g,"").replace(/,+/g,",").replace(/^,/,"").replace(/,$/,"").split(",").every(function(t){return t.match(/^[>,<=]?[0-9]+$/g)||t.match(/^[0-9]+-[0-9]+$/g)})}Object.defineProperty(n,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=t("preact"),c=t("preact-redux"),l=t("../structschema"),f=t("../component/form"),p=t("../component/dialog"),d=function(t){return t&&t.__esModule?t:{default:t}}(p);n.default=(0,c.connect)(function(t){return{formState:t.modal.form}})(i)},{"../component/dialog":594,"../component/form":595,"../structschema":648,preact:483,"preact-redux":482}],627:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function u(t){var e=t.selected,n=t.onSelect,r=t.result,o=s(t,["selected","onSelect","result"]);return(0,d.h)(m.default,{title:"R-Group",className:"rgroup",params:o,result:function(){return r()}},(0,d.h)("ul",null,(0,l.default)(1,33).map(function(t){return(0,d.h)("li",null,(0,d.h)("button",{className:e(t)?"selected":"",onClick:function(e){return n(t)}},"R"+t))})))}Object.defineProperty(n,"__esModule",{value:!0});var c=t("lodash/fp/range"),l=r(c),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),d=t("preact"),h=t("../component/dialog"),m=r(h),g=function(t){function e(t){var n=t.label;o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.state.label=n||null,r}return a(e,t),p(e,[{key:"onSelect",value:function(t){this.setState({label:t!==this.state.label?t:null})}},{key:"selected",value:function(t){return t===this.state.label}},{key:"result",value:function(){return{label:this.state.label}}},{key:"render",value:function(){var t=this;return(0,d.h)(u,f({selected:function(e){return t.selected(e)},onSelect:function(e){return t.onSelect(e)},result:function(){return t.result()}},this.props))}}]),e}(d.Component),v=function(t){function e(t){var n=t.values;o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.state.values=n||[],r}return a(e,t),p(e,[{key:"onSelect",value:function(t){var e=this.state.values,n=e.indexOf(t);n<0?e.push(t):e.splice(n,1),this.setState({values:e})}},{key:"selected",value:function(t){return this.state.values.includes(t)}},{key:"result",value:function(){return{type:"rlabel",values:this.state.values}}},{key:"render",value:function(){var t=this;return(0,d.h)(u,f({selected:function(e){return t.selected(e)},onSelect:function(e){return t.onSelect(e)},result:function(){return t.result()}},this.props))}}]),e}(d.Component);n.default=function(t){return"rlabel"===t.type?(0,d.h)(v,t):(0,d.h)(g,t)}},{"../component/dialog":594,"lodash/fp/range":436,preact:483}],628:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}
Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=t("preact"),c=t("preact-redux"),l=t("../structformat"),f=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(l),p=t("../state/templates"),d=t("../component/dialog"),h=r(d),m=t("../component/savebutton"),g=r(m),v=function(t){function e(t){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state={type:t.struct.hasRxnArrow()?"rxn":"mol"},n.changeType().catch(t.onCancel),n}return a(e,t),s(e,[{key:"changeType",value:function(t){var e=this,n=this.state.type;return t&&(n=t.target.value,t.preventDefault()),f.toString(this.props.struct,n,this.props.server,this.props.options).then(function(t){return e.setState({type:n,structStr:t})},function(t){alert(t)})}},{key:"render",value:function(){var t=this,e=this.state,n=e.type,r=e.structStr,o=f.map[n];return console.assert(o,"Unknown chemical file type"),(0,u.h)(h.default,{title:"Save Structure",className:"save",params:this.props,buttons:[(0,u.h)(g.default,{className:"save",data:r,filename:"ketcher"+o.ext[0],type:o.mime,server:this.props.server,onSave:function(){return t.props.onOk()}},"Save To File…"),(0,u.h)("button",{className:"save-tmpl",onClick:function(){return t.props.onTmplSave(r)}},"Save to Templates"),"Close"]},(0,u.h)("label",null,"Format:",(0,u.h)("select",{value:n,onChange:function(e){return t.changeType(e)}},[this.props.struct.hasRxnArrow()?"rxn":"mol","smiles","smarts","cml","inchi"].map(function(t){return(0,u.h)("option",{value:t},f.map[t].name)}))),(0,u.h)("textarea",{className:n,value:r,readonly:!0,ref:function(t){return t&&setTimeout(function(){return t.select()},10)}}))}}]),e}(u.Component);n.default=(0,c.connect)(function(t){return{server:t.server,struct:t.editor.struct(),options:t.options.getServerSettings()}},function(t){return{onTmplSave:function(e){return t((0,p.saveUserTmpl)(e))}}})(v)},{"../component/dialog":594,"../component/savebutton":599,"../state/templates":644,"../structformat":647,preact:483,"preact-redux":482}],629:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t){var e=t.title,n=t.name,r=t.schema,i=o(t,["title","name","schema"]),a=Object.keys(r).reduce(function(t,e){return t.enum.push(e),t.enumNames.push(r[e].title||e),t},{title:e,type:"string",default:"",minLength:1,enum:[],enumNames:[]});return(0,u.h)(l.Field,s({name:n,schema:a,component:h.default},i))}function a(t){var e=t.context,n=t.fieldName,r=t.fieldValue,a=t.type,c=t.radiobuttons,f=t.formState,d=o(t,["context","fieldName","fieldValue","type","radiobuttons","formState"]),h=f.result,v=f.valid,b={context:e,fieldName:n||(0,m.getSdataDefault)(e),type:a,radiobuttons:c};b.fieldValue=r||(0,m.getSdataDefault)(e,b.fieldName);var y=m.sdataSchema[h.context][h.fieldName]||m.sdataCustomSchema,_={context:h.context.trim(),fieldName:h.fieldName.trim(),fieldValue:"string"==typeof h.fieldValue?h.fieldValue.trim():h.fieldValue};return(0,u.h)(p.default,{title:"S-Group Properties",className:"sgroup",result:function(){return h},valid:function(){return v},params:d},(0,u.h)(l.Form,s({serialize:_,schema:y,init:b},f),(0,u.h)(l.SelectOneOf,{title:"Context",name:"context",schema:m.sdataSchema}),(0,u.h)("fieldset",{className:"data"},(0,u.h)(i,{title:"Field name",name:"fieldName",schema:m.sdataSchema[h.context]}),g(y,h.context,h.fieldName))))}Object.defineProperty(n,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=t("preact"),c=t("preact-redux"),l=t("../component/form"),f=t("../component/dialog"),p=r(f),d=t("../component/combobox"),h=r(d),m=t("../data/sdata-schema"),g=function(t,e,n){return Object.keys(t.properties).filter(function(t){return"type"!==t&&"context"!==t&&"fieldName"!==t}).map(function(t){return"radiobuttons"===t?(0,u.h)(l.Field,{name:t,type:"radio",key:e+"-"+n+"-"+t+"-radio"}):(0,u.h)(l.Field,{name:t,type:"textarea",multiple:!0,size:"10",key:e+"-"+n+"-"+t+"-select"})})};n.default=(0,c.connect)(function(t){return{formState:t.modal.form}})(a)},{"../component/combobox":593,"../component/dialog":594,"../component/form":595,"../data/sdata-schema":608,preact:483,"preact-redux":482}],630:[function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t){var e=t.formState,n=r(t,["formState"]),o=e.result,s=e.valid,u=o.type;return(0,a.h)(p.default,{title:"S-Group Properties",className:"sgroup",result:function(){return o},valid:function(){return s},params:n},(0,a.h)(c.Form,i({schema:d[u],init:n},e),(0,a.h)(c.SelectOneOf,{title:"Type",name:"type",schema:d}),(0,a.h)("fieldset",{className:"DAT"===u?"data":"base"},h(u))))}Object.defineProperty(n,"__esModule",{value:!0});var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=t("preact"),s=t("preact-redux"),u=t("../structschema"),c=t("../component/form"),l=t("../utils"),f=t("../component/dialog"),p=function(t){return t&&t.__esModule?t:{default:t}}(f),d=(0,l.mapOf)(u.sgroup,"type"),h=function(t){return Object.keys(d[t].properties).filter(function(t){return"type"!==t}).map(function(e){var n={};return"name"===e&&(n.maxlength=15),"fieldName"===e&&(n.maxlength=30),"fieldValue"===e&&(n.type="textarea"),"radiobuttons"===e&&(n.type="radio"),(0,a.h)(c.Field,i({name:e,key:t+"-"+e},n))})};n.default=(0,s.connect)(function(t){return{formState:t.modal.form}})(o)},{"../component/dialog":594,"../component/form":595,"../structschema":648,"../utils":650,preact:483,"preact-redux":482}],631:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){var e={struct:c(t.struct),props:{atomid:+t.props.atomid||0,bondid:+t.props.bondid||0}};return e.struct.name=t.struct.name,e}function c(t){var e=t.clone(),n=e.getCoordBoundingBox();return e.atoms.each(function(t,e){e.pp=e.pp.sub(n.min)}),e}function l(t){var e=t.getCoordBoundingBox(),n=200/Math.max(e.max.y-e.min.y,e.max.x-e.min.x);return n<35&&(n=35),n>75&&(n=75),n}Object.defineProperty(n,"__esModule",{value:!0});var f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),d=t("preact"),h=t("preact-redux"),m=t("../component/dialog"),g=r(m),v=t("../component/input"),b=r(v),y=t("../component/structeditor"),_=r(y),x=t("../utils"),w=t("../state/templates"),S={selectionStyle:{fill:"#47b3ec",stroke:"none"},highlightStyle:{stroke:"#1a7090","stroke-width":1.2}},O=function(t){function e(t){var n=t.onInit,r=o(t,["onInit"]);i(this,e);var s=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return s.tmpl=u(r.tmpl),n(s.tmpl.struct.name,s.tmpl.props),s.onResult=s.onResult.bind(s),s}return s(e,t),p(e,[{key:"onResult",value:function(){var t=this.props,e=t.name,n=t.atomid,r=t.bondid;return!e||e===this.tmpl.struct.name&&n===this.tmpl.props.atomid&&r===this.tmpl.props.bondid?null:{name:e,attach:{atomid:n,bondid:r}}}},{key:"render",value:function(){var t=this.props,e=t.name,n=t.atomid,r=t.bondid,i=t.onNameEdit,a=t.onAttachEdit,s=o(t,["name","atomid","bondid","onNameEdit","onAttachEdit"]),u=this.tmpl.struct,c=Object.assign(S,{scale:l(u)});return(0,d.h)(g.default,{title:"Template Edit",className:"attach",result:this.onResult,params:s},(0,d.h)("label",null,"Template name:",(0,d.h)(b.default,{value:e,onChange:i})),(0,d.h)("label",null,"Choose attachment atom and bond:"),(0,d.h)(_.default,{className:"editor",struct:u,onAttachEdit:a,tool:"attach",toolOpts:{atomid:n,bondid:r},options:c}),x.storage.isAvailable()?null:(0,d.h)("div",{className:"warning"},x.storage.warningMessage))}}]),e}(d.Component);n.default=(0,h.connect)(function(t){return f({},t.templates.attach)},function(t){return{onInit:function(e,n){return t((0,w.initAttach)(e,n))},onAttachEdit:function(e){return t((0,w.setAttachPoints)(e))},onNameEdit:function(e){return t((0,w.setTmplName)(e))}}})(O)},{"../component/dialog":594,"../component/input":596,"../component/structeditor":602,"../state/templates":644,"../utils":650,preact:483,"preact-redux":482}],632:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function u(t,e){return console.assert(t.props&&t.props.group,"No group"),t.struct.name||t.props.group+" template "+(e+1)}function c(t,e){return console.warn("partition",t),(0,S.default)(t)(e)}function l(t){return t.replace(Y,function(t){return K[t]})}function f(t,e){console.warn("Filter",e);var n=new RegExp((0,A.default)(l(e)),"i");return(0,x.default)((0,y.default)(function(t){return!e||n.test(l(t.struct.name))||n.test(l(t.props.group))}),(0,v.default)(function(t,e){return t[e.props.group]?t[e.props.group].push(e):t[e.props.group]=[e],t},{}))(t)}function p(t,e,n){return console.warn("Group",e),c(n,t[e])}function d(t){var e=t.tmpl,n=s(t,["tmpl"]);return e.props&&e.props.prerender?(0,T.h)("svg",n,(0,T.h)("use",{xlinkHref:e.props.prerender})):(0,T.h)(M.default,j({struct:e.struct,options:{autoScaleMargin:15}},n))}Object.defineProperty(n,"__esModule",{value:!0});var h=t("lodash/fp/omit"),m=r(h),g=t("lodash/fp/reduce"),v=r(g),b=t("lodash/fp/filter"),y=r(b),_=t("lodash/fp/flow"),x=r(_),w=t("lodash/fp/chunk"),S=r(w),O=t("lodash/fp/escapeRegExp"),A=r(O),E=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),j=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},P=t("reselect"),T=t("preact"),C=t("preact-redux"),R=t("../../chem/sdf"),N=r(R),k=t("../component/visibleview"),I=r(k),B=t("../component/structrender"),M=r(B),L=t("../component/dialog"),D=r(L),F=t("../component/savebutton"),G=r(F),z=t("../component/input"),U=r(z),W=t("../component/select"),H=r(W),V=t("../state/templates"),q=t("../state/"),K={Alpha:"A",alpha:"α",Beta:"B",beta:"β",Gamma:"Г",gamma:"γ"},Y=new RegExp("\\b"+Object.keys(K).join("\\b|\\b")+"\\b","g"),$=(0,P.createSelector)(function(t){return t.lib},function(t){return t.filter},f),Z=(0,P.createSelector)(function(t){return t.lib},function(t){return t.group},function(t){return t.COLS},p),X=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),E(e,[{key:"select",value:function(t){t===this.props.selected?this.props.onOk(this.result()):this.props.onSelect(t)}},{key:"result",value:function(){var t=this.props.selected;return console.assert(!t||t.props,"Incorrect SDF parse"),t?{struct:t.struct,aid:parseInt(t.props.atomid)||null,bid:parseInt(t.props.bondid)||null}:null}},{key:"renderRow",value:function(t,e,n){var r=this;return(0,T.h)("div",{className:"tr",key:e},t.map(function(t,o){return(0,T.h)("div",{className:t===r.props.selected?"td selected":"td",title:l(u(t,e*n+o))},(0,T.h)(d,{tmpl:t,className:"struct",onClick:function(){return r.select(t)}}),(0,T.h)("button",{className:"attach-button",onClick:function(){return r.props.onAttach(t)}},"Edit"))}))}},{key:"render",value:function(){var t=this,e=this.props,n=e.group,r=e.filter,o=e.onFilter,i=e.onChangeGroup,a=s(e,["group","filter","onFilter","onChangeGroup"]),u=$(this.props);return n=u[n]?n:Object.keys(u)[0],(0,T.h)(D.default,{title:"Template Library",className:"template-lib",params:a,result:function(){return t.result()},buttons:[(0,T.h)(G.default,{className:"save",data:N.default.stringify(this.props.lib),filename:"ketcher-tmpls.sdf"},"Save To SDF…"),"OK","Cancel"]},(0,T.h)("label",null,(0,T.h)(U.default,{type:"search",placeholder:"Filter",value:r,onChange:function(t){return o(t)}})),(0,T.h)(U.default,{className:"groups",component:H.default,splitIndexes:[Object.keys(u).indexOf("User Templates")],value:n,onChange:function(t){return i(t)},schema:{enum:Object.keys(u),enumNames:Object.keys(u).map(function(t){return l(t)})}}),(0,T.h)(I.default,{data:Z({lib:u,group:n,COLS:3}),rowHeight:120,className:"table"},function(e,n){return t.renderRow(e,n,3)}))}}]),e}(T.Component);n.default=(0,C.connect)(function(t){return j({},(0,m.default)(["attach"],t.templates))},function(t,e){return{onFilter:function(e){return t((0,V.changeFilter)(e))},onSelect:function(e){return t((0,V.selectTmpl)(e))},onChangeGroup:function(e){return t((0,V.changeGroup)(e))},onAttach:function(e){return t((0,V.editTmpl)(e))},onOk:function(n){t((0,q.onAction)({tool:"template",opts:n})),e.onOk(n)}}})(X)},{"../../chem/sdf":525,"../component/dialog":594,"../component/input":596,"../component/savebutton":599,"../component/select":600,"../component/structrender":603,"../component/visibleview":606,"../state/":639,"../state/templates":644,"lodash/fp/chunk":422,"lodash/fp/escapeRegExp":425,"lodash/fp/filter":426,"lodash/fp/flow":429,"lodash/fp/omit":432,"lodash/fp/reduce":437,preact:483,"preact-redux":482,reselect:505}],633:[function(t,e,n){"use strict";function r(t,e){var n=document.querySelector("[role=application]")||document.body;return(0,i.default)(n,t,e)}Object.defineProperty(n,"__esModule",{value:!0});var o=t("./app"),i=function(t){return t&&t.__esModule?t:{default:t}}(o);n.default=r},{"./app":588}],634:[function(t,e,n){"use strict";function r(t){var e=t.split(/\+(?!$)/),n=e[e.length-1];"Space"===n&&(n=" ");for(var r=void 0,o=void 0,i=void 0,a=void 0,s=0;s<e.length-1;s++){var u=e[s];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))i=!0;else{if(!/^mod$/i.test(u))throw new Error("Unrecognized modifier name: "+u);p?a=!0:o=!0}}return r&&(n="Alt+"+n),o&&(n="Ctrl+"+n),a&&(n="Meta+"+n),i&&(n="Shift+"+n),n}function o(t){var e=Object.create(null);for(var n in t)t.hasOwnProperty(n)&&(e[r(n)]=t[n]);return e}function i(t,e,n){return e.altKey&&(t="Alt+"+t),e.ctrlKey&&(t="Ctrl+"+t),e.metaKey&&(t="Meta+"+t),!1!==n&&e.shiftKey&&(t="Shift+"+t),t}function a(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(0,f.default)(t),r=1===n.length&&" "!==n;return r&&!e?i(n,t,!r):i(f.default.base[t.keyCode],t,!0)}function s(t){return t instanceof KeyboardEvent?a.apply(void 0,arguments):"object"===(void 0===t?"undefined":c(t))?o(t):r(t)}function u(t,e){var n=(0,f.default)(e),r=1===n.length&&" "!==n,o=t[i(n,e,!r)],a=void 0;return e.shiftKey&&r&&(a=f.default.base[e.keyCode])&&(o=t[i(a,e,!0)]||o),o}Object.defineProperty(n,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=t("w3c-keyname"),f=function(t){return t&&t.__esModule?t:{default:t}}(l),p="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);s.lookup=u,n.default=s},{"w3c-keyname":513}],635:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t,e){var n=e.action,r=e.editor,o=e.server,i=e.options;if(n.tool){if(r.tool(n.tool,n.opts))return n}else"function"==typeof n?n(r,o,i):console.info("no action");return t}function a(t,e,n){var r=n.editor,o=n.server;return"function"==typeof t.selected?t.selected(r,o):!(!t.action||!t.action.tool)&&(0,h.default)(e,t.action)}function s(t,e){var n=e.editor,r=e.server,o=e.options;return"function"==typeof t.disabled&&t.disabled(n,r,o)}function u(t,e,n){var r=v.default[t];return(0,l.default)(function(t){return t},{selected:a(r,e,n),disabled:s(r,n)})}Object.defineProperty(n,"__esModule",{value:!0});var c=t("lodash/fp/pickBy"),l=r(c),f=t("lodash/fp/isEmpty"),p=r(f),d=t("lodash/fp/isEqual"),h=r(d),m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments[1],n=e.type,r=e.action,a=o(e,["type","action"]);switch(n){case"INIT":r=v.default["select-lasso"].action;case"ACTION":var s=i(t&&t.activeTool,m({},a,{action:r}));case"UPDATE":return Object.keys(v.default).reduce(function(t,e){var n=u(e,t.activeTool,a);return(0,p.default)(n)||(t[e]=n),t},{activeTool:s||t.activeTool});default:return t}};var g=t("../action"),v=r(g)},{"../action":583,"lodash/fp/isEmpty":430,"lodash/fp/isEqual":431,"lodash/fp/pickBy":434}],636:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){function n(t,e){var n=e().options.settings.resetToSelect,o=e().actionState.activeTool.tool;!0===n||n===o?t({type:"ACTION",action:l.default["select-lasso"].action}):r()}var r=(0,a.default)(100,function(){return t({type:"UPDATE"})}),o=function(t){return new Promise(function(e){return setTimeout(e,t)})};return{onInit:function(e){t({type:"INIT",editor:e})},onChange:function(){t(n)},onSelectionChange:function(){r()},onElementEdit:function(e){var n=(0,p.fromElement)(e),r=null;return r=u.default.map[n.label]?(0,f.openDialog)(t,"atomProps",n):1===Object.keys(n).length&&"ap"in n?(0,f.openDialog)(t,"attachmentPoints",n.ap).then(function(t){return{ap:t}}):"list"===n.type||"not-list"===n.type?(0,f.openDialog)(t,"period-table",n):"rlabel"===n.type?(0,f.openDialog)(t,"rgroup",n):(0,f.openDialog)(t,"period-table",n),r.then(p.toElement)},onQuickEdit:function(e){return(0,f.openDialog)(t,"labelEdit",e)},onBondEdit:function(e){return(0,f.openDialog)(t,"bondProps",(0,p.fromBond)(e)).then(p.toBond)},onRgroupEdit:function(n){if(Object.keys(n).length>1){var r=[];return e().editor.struct().rgroups.each(function(t){return r.push(t)}),n.range||(n.range=">0"),(0,f.openDialog)(t,"rgroupLogic",Object.assign({rgroupLabels:r},n))}return(0,f.openDialog)(t,"rgroup",n)},onSgroupEdit:function(e){return o(0).then(function(){return(0,f.openDialog)(t,"sgroup",(0,p.fromSgroup)(e))}).then(p.toSgroup)},onSdataEdit:function(e){return o(0).then(function(){return(0,f.openDialog)(t,"DAT"===e.type?"sdata":"sgroup",(0,p.fromSgroup)(e))}).then(p.toSgroup)},onMessage:function(t){if(t.error)alert(t.error);else{var e=Object.keys(t)[0];console[e](t[e])}},onMouseDown:function(t){}}}Object.defineProperty(n,"__esModule",{value:!0});var i=t("lodash/fp/debounce"),a=r(i);n.initEditor=o;var s=t("../../chem/element"),u=r(s),c=t("../action"),l=r(c),f=t("./"),p=t("../structconv")},{"../../chem/element":516,"../action":583,"../structconv":646,"./":639,"lodash/fp/debounce":424}],637:[function(t,e,n){"use strict";function r(t){return{type:"UPDATE_FORM",data:t}}function o(t){return{type:"UPDATE_FORM",data:{moleculeErrors:t}}}function i(){return{type:"UPDATE_FORM",data:{result:(0,s.getDefaultOptions)(),valid:!0,errors:{}}}}function a(t,e,n){return"sdata"===n?(0,u.sdataReducer)(t,e):Object.assign({},t,e.data)}Object.defineProperty(n,"__esModule",{value:!0}),n.formsState=void 0,n.updateFormState=r,n.checkErrors=o,n.setDefaultSettings=i,n.formReducer=a;var s=t("../data/options-schema"),u=t("./sdata");n.formsState={atomProps:{errors:{},valid:!0,result:{label:"",charge:0,explicitValence:-1,hCount:0,invRet:0,isotope:0,radical:0,ringBondCount:0,substitutionCount:0}},attachmentPoints:{errors:{},valid:!0,result:{primary:!1,secondary:!1}},automap:{errors:{},valid:!0,result:{mode:"discard"}},bondProps:{errors:{},valid:!0,result:{type:"single",topology:0,center:0}},check:{errors:{},moleculeErrors:{},result:{checkOptions:["valence","radicals","pseudoatoms","stereo","query","overlapping_atoms","overlapping_bonds","rgroups","chiral","3d"]}},labelEdit:{errors:{},valid:!0,result:{label:""}},rgroupLogic:{errors:{},valid:!0,result:{ifthen:0,range:">0",resth:!1}},settings:{errors:{},valid:!0,result:(0,s.getDefaultOptions)()},sgroup:{errors:{},valid:!0,result:{type:"GEN"}},sdata:(0,u.initSdata)()}},{"../data/options-schema":607,"./sdata":642}],638:[function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t){return t&&t.__esModule?t:{default:t}}function i(t){return function(e,n){var r=u();t.addEventListener("keydown",function(t){return a(e,n,r,t)})}}function a(t,e,n,r){var o=e();if(!o.modal){var i=o.editor,a=o.actionState,s=a.activeTool,u=(0,y.default)(r),l=i.selection()&&i.selection().atoms,f=null;if(u&&1===u.length&&l&&u.match(/\w/))console.assert(l.length>0),(0,E.openDialog)(t,"labelEdit",{letter:u}).then(function(e){t((0,E.onAction)({tool:"atom",opts:e}))}),r.preventDefault();else if(f=y.default.lookup(n,r)){var p=c(f,s);p=(p+1)%f.length;var d=f[p];if(a[d]&&!0===a[d].disabled)return r.preventDefault();if(-1===S.actions.indexOf(d)){var h=x.default[d].action;t((0,E.onAction)(h)),r.preventDefault()}else window.clipboardData&&S.exec(r)}}}function s(t,e,n){Array.isArray(n[t])?n[t].push(e):n[t]=[e]}function u(){var t={},e=void 0;for(var n in x.default){(function(n){if(e=x.default[n],!e.shortcut)return"continue";Array.isArray(e.shortcut)?e.shortcut.forEach(function(e){return s(e,n,t)}):s(e.shortcut,n,t)})(n)}return(0,y.default)(t)}function c(t,e){var n=t.indexOf(e.tool);return t.forEach(function(t,r){(0,m.default)(x.default[t].action,e)&&(n=r)}),n}function l(t,e){var n=Object.keys(A.map).map(function(t){return A.map[t].mime}),r=(0,d.default)(0,function(e){return t((0,E.onAction)(e))}),o=(0,d.default)(0,function(e,n){return t((0,E.load)(e,n))});return{formats:n,focused:function(){return!e().modal},onCut:function(){var t=f(e().editor);return r({tool:"eraser",opts:1}),t},onCopy:function(){var t=e().editor,n=f(t);return t.selection(null),n},onPaste:function(t){var e=t["chemical/x-mdl-molfile"]||t["chemical/x-mdl-rxnfile"]||t["text/plain"];e&&o(e,{fragment:!0})}}}function f(t){var e={},n=t.structSelected();if(n.isBlank())return null;var r=n.isReaction?"chemical/x-mdl-molfile":"chemical/x-mdl-rxnfile";return e["text/plain"]=e[r]=v.default.stringify(n),e}Object.defineProperty(n,"__esModule",{value:!0});var p=t("lodash/fp/debounce"),d=o(p),h=t("lodash/fp/isEqual"),m=o(h);n.initKeydownListener=i,n.initClipboard=l;var g=t("../../chem/molfile"),v=o(g),b=t("../keynorm"),y=o(b),_=t("../action"),x=o(_),w=t("../component/cliparea"),S=r(w),O=t("../structformat"),A=r(O),E=t("./")},{"../../chem/molfile":519,"../action":583,"../component/cliparea":592,"../keynorm":634,"../structformat":647,"./":639,"lodash/fp/debounce":424,"lodash/fp/isEqual":431}],639:[function(t,e,n){(function(e){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments[1],n=e.type,r=e.data;if("UPDATE_FORM"===n){var o=(0,b.formReducer)(t.form,e,t.name);return p({},t,{form:o})}switch(n){case"MODAL_CLOSE":return null;case"MODAL_OPEN":return{name:r.name,form:b.formsState[r.name]||null,prop:r.prop||null};default:return t}}function a(t){return t&&t.dialog?{type:"MODAL_OPEN",data:{name:t.dialog}}:t&&t.thunk?t.thunk:{type:"ACTION",action:t}}function s(t,e,n){return new Promise(function(r,o){t({type:"MODAL_OPEN",data:{name:e,prop:p({},n,{onResult:r,onCancel:o})}})})}function u(t,e){return function(n,r){var o=r(),i=o.editor,s=o.server;e=e||{};var u=v.fromString(t,e,s);return u.catch(function(t){alert("Can't parse molecule!")}),u.then(function(t){return console.assert(t,"No molecule to update"),e.rescale&&t.rescale(),e.fragment&&!t.isBlank()?n(a({tool:"paste",opts:t})):i.struct(t),t},function(t){alert(t)})}}function c(t,n){switch(n.type){case"INIT":e._ui_editor=n.editor;case"UPDATE":var r=(n.type,o(n,["type"]));r&&(t=p({},t,r))}var i=A(t,p({},n,(0,f.default)(["editor","server","options"],t)));return i===t.shared?t:p({},t,i)}Object.defineProperty(n,"__esModule",{value:!0});var l=t("lodash/fp/pick"),f=r(l),p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.onAction=a,n.openDialog=s,n.load=u,n.default=function(t,e){var n={actionState:null,options:Object.assign(y.optionsState,{app:t}),server:e||Promise.reject("Standalone mode!"),editor:null,modal:null,templates:_.initTmplState},r=[m.default];return(0,d.createStore)(c,n,d.applyMiddleware.apply(void 0,r))};var d=t("redux"),h=t("redux-thunk"),m=r(h),g=(t("redux-logger"),t("../structformat")),v=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(g),b=t("./form"),y=t("./options"),_=t("./templates"),x=t("./action"),w=r(x),S=t("./toolbar"),O=r(S),A=(0,d.combineReducers)({actionState:w.default,toolbar:O.default,modal:i,server:function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},editor:function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:null},options:y.optionsReducer,templates:_.templatesReducer})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../structformat":647,"./action":635,"./form":637,"./options":641,"./templates":644,"./toolbar":645,"lodash/fp/pick":433,redux:502,"redux-logger":495,"redux-thunk":496}],640:[function(t,e,n){"use strict";function r(t,e){var n=e().editor,r=e().server;a.toString(n.struct(),"cml",r).then(function(e){(0,o.openDialog)(t,"miew",{structStr:e}).then(function(e){e.structStr&&t((0,o.load)(e.structStr))})})}Object.defineProperty(n,"__esModule",{value:!0}),n.miewAction=r;var o=t("./"),i=t("../structformat"),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(i)},{"../structformat":647,"./":639}],641:[function(t,e,n){"use strict";function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t){return function(e){e({type:"APP_OPTIONS",data:t}),e({type:"UPDATE"})}}function i(t){return m.storage.setItem("ketcher-opts",t),{type:"SAVE_SETTINGS",data:t}}function a(t,e){return{type:"CHANGE_ANALYSE",data:r({},t,e)}}function s(t){return{type:"SET_RECOGNIZE_STRUCT",data:{structStr:t}}}function u(t){return{type:"CHANGE_RECOGNIZE_FILE",data:{file:t,structStr:null}}}function c(t){return{type:"IS_FRAGMENT_RECOGNIZE",data:{fragment:t}}}function l(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1],n=e.type,r=e.data;return"APP_OPTIONS"===n?d({},t,{app:d({},t.app,r)}):"SAVE_SETTINGS"===n?d({},t,{settings:r}):"CHANGE_ANALYSE"===n?d({},t,{analyse:d({},t.analyse,r)}):g.includes(n)?d({},t,{recognize:d({},t.recognize,r)}):t}Object.defineProperty(n,"__esModule",{value:!0}),n.optionsState=void 0;var f=t("lodash/fp/pick"),p=function(t){return t&&t.__esModule?t:{default:t}}(f),d=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.appUpdate=o,n.saveSettings=i,n.changeRound=a,n.setStruct=s,n.changeImage=u,n.shouldFragment=c,n.optionsReducer=l;var h=t("../data/options-schema"),m=t("../utils"),g=(n.optionsState={app:{server:!1,templates:!1},analyse:{values:null,roundWeight:3,roundMass:3},recognize:{file:null,structStr:null,fragment:!1},settings:Object.assign((0,h.getDefaultOptions)(),(0,h.validation)(m.storage.getItem("ketcher-opts"))),getServerSettings:function(){return(0,p.default)(h.SERVER_OPTIONS,this.settings)}},["SET_RECOGNIZE_STRUCT","CHANGE_RECOGNIZE_FILE","IS_FRAGMENT_RECOGNIZE"])},{"../data/options-schema":607,"../utils":650,"lodash/fp/pick":433}],642:[function(t,e,n){"use strict";function r(t,e){if(e.data.result.init)return a(o({},t,{result:Object.assign({},t.result,e.data.result)}),e.data);var n=e.data.result.context,r=e.data.result.fieldName,i=null;return n!==t.result.context?i=s(t,e.data.result):r!==t.result.fieldName&&(i=u(t,e.data.result)),i=i||o({},t,{result:Object.assign({},t.result,e.data.result)}),a(i,e.data)}Object.defineProperty(n,"__esModule",{value:!0}),n.initSdata=void 0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.sdataReducer=r;var i=t("../data/sdata-schema"),a=(n.initSdata=function(){var t=(0,i.getSdataDefault)(),e=(0,i.getSdataDefault)(t);return{errors:{},valid:!0,result:{context:t,fieldName:e,fieldValue:(0,i.getSdataDefault)(t,e),radiobuttons:"Absolute",type:"DAT"}}},function(t,e){var n=e.valid,r=e.errors,o=t.result,i=o.fieldName,a=o.fieldValue;return{result:t.result,valid:n&&!!i&&!!a,errors:r}}),s=function(t,e){var n=e.context,r=e.fieldValue,a=(0,i.getSdataDefault)(n),s=r;return s===t.result.fieldValue&&(s=(0,i.getSdataDefault)(n,a)),{result:o({},e,{context:n,fieldName:a,fieldValue:s})}},u=function(t,e){var n=e.fieldName,r=t.result.context,a=e.fieldValue;return i.sdataSchema[r][n]&&(a=(0,i.getSdataDefault)(r,n)),a===t.result.fieldValue&&i.sdataSchema[r][t.result.fieldName]&&(a=""),{result:o({},e,{fieldName:n,fieldValue:a})}}},{"../data/sdata-schema":608}],643:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(){return function(t,e){e().server.then(function(e){return t((0,b.appUpdate)({indigoVersion:e.indigoVersion,server:!0}))},function(t){return console.info(t)})}}function i(t){return function(e,n){var r=n().server.recognize,o=r(t).then(function(t){e((0,b.setStruct)(t.struct))},function(t){e((0,b.setStruct)(null)),setTimeout(function(){return alert("Error! The picture isn't recognized.")},200)});e((0,b.setStruct)(o))}}function a(t){
return function(e,n){var r=n(),o=r.editor,i=r.server,a=n().options.getServerSettings();a.data={types:t},l(o,i,"check",a).then(function(t){return e((0,y.checkErrors)(t))}).catch(console.error)}}function s(t){return c("automap",t)}function u(){return function(t,e){var n=e(),r=n.editor,o=n.server,i=e().options.getServerSettings();i.data={properties:["molecular-weight","most-abundant-mass","monoisotopic-mass","gross","mass-composition"]},l(r,o,"calculate",i).then(function(e){t({type:"CHANGE_ANALYSE",data:{values:e}})})}}function c(t,e,n){return function(r,o){var i=o(),a=i.options.getServerSettings();a.data=e,l(i.editor,i.server,t,a,n).then(function(e){r((0,_.load)(e.struct,{rescale:"layout"===t}))})}}function l(t,e,n,r,o){var i=t.selection(),a=[];if(i&&(a=i.atoms?i.atoms:t.explicitSelected().atoms),!o){var s={};o=t.struct().clone(null,null,!1,s);var u=f(o.getComponents());a=a.map(function(t){return u[s[t]]})}var c=e.then(function(){return e[n](Object.assign({struct:v.default.stringify(o,{ignoreErrors:!0})},a&&a.length>0?{selected:a}:null,r.data),(0,h.default)("data",r))});return c.catch(function(t){alert(t)}).then(function(t){}),c}function f(t){return p(t.reactants).concat(p(t.products)).reduce(function(t,e,n){return t[e]=n,t},{})}function p(t){return"object"!==(void 0===t?"undefined":m(t))?t:Object.keys(t).reduce(function(e,n){var r=t[n];return e.concat(p(r))},[])}Object.defineProperty(n,"__esModule",{value:!0});var d=t("lodash/fp/omit"),h=r(d),m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};n.checkServer=o,n.recognize=i,n.check=a,n.automap=s,n.analyse=u,n.serverTransform=c;var g=t("../../chem/molfile"),v=r(g),b=t("./options"),y=t("./form"),_=t("./")},{"../../chem/molfile":519,"./":639,"./form":637,"./options":641,"lodash/fp/omit":432}],644:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){return{type:"TMPL_SELECT",data:{selected:t}}}function i(t){return{type:"TMPL_CHANGE_GROUP",data:{group:t,selected:null}}}function a(t){return{type:"TMPL_CHANGE_FILTER",data:{filter:t.trim(),selected:null}}}function s(t,e){return{type:"INIT_ATTACH",data:{name:t,atomid:e.atomid,bondid:e.bondid}}}function u(t){return{type:"SET_ATTACH_POINTS",data:{atomid:t.atomid,bondid:t.bondid}}}function c(t){return{type:"SET_TMPL_NAME",data:{name:t}}}function l(t){return function(e,n){(0,P.openDialog)(e,"attach",{tmpl:t}).then(function(r){var o=r.name,i=r.attach;t.struct.name=o,t.props=Object.assign({},t.props,i),"User Templates"===t.props.group&&p(n().templates.lib),(0,P.openDialog)(e,"templates")},function(){(0,P.openDialog)(e,"templates")})}}function f(t){var e={struct:E.default.parse(t),props:{}};return function(t,n){(0,P.openDialog)(t,"attach",{tmpl:e}).then(function(r){var o=r.name,i=r.attach;e.struct.name=o,e.props=w({},i,{group:"User Templates"});var a=n().templates.lib.concat(e);t(h(a)),p(a)})}}function p(t){var e=t.filter(function(t){return"User Templates"===t.props.group}).map(function(t){return{struct:E.default.stringify(t.struct),props:Object.assign({},(0,x.default)(["group"],t.props))}});T.storage.setItem("ketcher-tmpls",e)}function d(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:C,e=arguments[1];if(R.includes(e.type))return Object.assign({},t,e.data);if(N.includes(e.type)){var n=Object.assign({},t.attach,e.data);return w({},t,{attach:n})}return t}function h(t){return{type:"TMPL_INIT",data:{lib:t}}}function m(t,e,n){v(e+"library.sdf").then(function(t){var r=O.default.parse(t);return y(r,e,n).then(function(t){return r.map(function(e){var n=b(e);return n.file&&(e.props.prerender=-1!==t.indexOf(n.file)?"#"+n.id:""),e})})}).then(function(e){var n=e.concat(g());t(h(n)),t((0,j.appUpdate)({templates:!0}))})}function g(){var t=T.storage.getItem("ketcher-tmpls");return Array.isArray(t)&&0!==t.length?t.map(function(t){try{return""===t.props&&(t.props={}),t.props.group="User Templates",{struct:E.default.parse(t.struct),props:t.props}}catch(t){return null}}).filter(function(t){return null!==t}):[]}function v(t){return fetch(t,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.text();throw"Could not fetch "+t})}function b(t){var e=t.props.prerender,n=e&&e.split("#",2);return{file:e&&n[0],id:e&&n[1]}}function y(t,e,n){var r=t.reduce(function(t,e){var n=b(e).file;return n&&-1===t.indexOf(n)&&t.push(n),t},[]);return Promise.all(r.map(function(t){return v(e+t).catch(function(){return null})})).then(function(t){return t.forEach(function(t){t&&(n.innerHTML+=t)}),r.filter(function(e,n){return!!t[n]})})}Object.defineProperty(n,"__esModule",{value:!0}),n.initTmplState=void 0;var _=t("lodash/fp/omit"),x=r(_),w=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.selectTmpl=o,n.changeGroup=i,n.changeFilter=a,n.initAttach=s,n.setAttachPoints=u,n.setTmplName=c,n.editTmpl=l,n.saveUserTmpl=f,n.templatesReducer=d,n.initTmplLib=m;var S=t("../../chem/sdf"),O=r(S),A=t("../../chem/molfile"),E=r(A),j=t("./options"),P=t("./"),T=t("../utils"),C=n.initTmplState={lib:[],selected:null,filter:"",group:null,attach:{}},R=["TMPL_INIT","TMPL_SELECT","TMPL_CHANGE_GROUP","TMPL_CHANGE_FILTER"],N=["INIT_ATTACH","SET_ATTACH_POINTS","SET_TMPL_NAME"]},{"../../chem/molfile":519,"../../chem/sdf":525,"../utils":650,"./":639,"./options":641,"lodash/fp/omit":432}],645:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(){return function(t,e){var n=(0,h.default)(100,function(){e().editor.render.update(),t({type:"CLEAR_VISIBLE"})});addEventListener("resize",n)}}function a(t,e,n){return t=(0,g.default)(t),b.basic.indexOf(t)>-1||-1!==e.indexOf(t)?{freqAtoms:e}:(e[n]=t,n=(n+1)%w,{freqAtoms:e,currentAtom:n})}function s(t){return{type:"ADD_ATOMS",data:t}}function u(t){var e=null;for(var n in _.default)_.default.hasOwnProperty(n)&&(0,p.default)(t,_.default[n].action)&&(e=n);return e}function c(t){var e=u(t),n=document.getElementById(e),r=n&&l(n);return r?o({},r.id,n.id):null}function l(t,e){e=e||document.body;for(var n=t;"hidden"!==window.getComputedStyle(n).overflow&&!n.classList.contains("opened");){if(n===e)return null;n=n.parentNode}return n}Object.defineProperty(n,"__esModule",{value:!0});var f=t("lodash/fp/isEqual"),p=r(f),d=t("lodash/fp/debounce"),h=r(d),m=t("lodash/fp/capitalize"),g=r(m),v=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.initResize=i,n.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x,e=arguments[1],n=e.type,r=e.data;switch(n){case"ACTION":var o=c(e.action);return o?v({},t,{opened:null,visibleTools:v({},t.visibleTools,o)}):t;case"ADD_ATOMS":var i=a(r,t.freqAtoms,t.currentAtom);return v({},t,i);case"CLEAR_VISIBLE":return v({},t,{opened:null,visibleTools:{}});case"OPENED":return v({},t,{opened:r});case"UPDATE":return v({},t,{opened:null});default:return t}},n.addAtoms=s,n.hiddenAncestor=l;var b=t("../action/atoms"),y=t("../action/tools"),_=r(y),x={freqAtoms:[],currentAtom:0,opened:null,visibleTools:{}},w=7},{"../action/atoms":581,"../action/tools":586,"lodash/fp/capitalize":421,"lodash/fp/debounce":424,"lodash/fp/isEqual":431}],646:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t){return"R#"===t.label?{type:"rlabel",values:d(t.rglabel)}:"L#"===t.label?c(t):j.default.map[t.label]?s(t):!t.label&&"attpnt"in t?{ap:f(t.attpnt)}:t}function a(t){return"rlabel"===t.type?{label:t.values.length?"R#":"C",rglabel:h(t.values)}:"list"===t.type||"not-list"===t.type?l(t):!t.label&&"ap"in t?{attpnt:p(t.ap)}:j.default.map[(0,w.default)(t.label)]?u(t):"A"===t.label||"*"===t.label||"Q"===t.label||"X"===t.label||"R"===t.label?(t.pseudo=t.label,u(t)):t}function s(t){return{alias:t.alias||"",label:t.label,charge:t.charge,isotope:t.isotope,explicitValence:t.explicitValence,radical:t.radical,invRet:t.invRet,exactChangeFlag:!!t.exactChangeFlag,ringBondCount:t.ringBondCount,substitutionCount:t.substitutionCount,unsaturatedAtom:!!t.unsaturatedAtom,hCount:t.hCount}}function u(t){return Object.assign({},t,{label:(0,w.default)(t.label)})}function c(t){return{type:t.atomList.notList?"not-list":"list",values:t.atomList.ids.map(function(t){return j.default[t].label})}}function l(t){return{pseudo:null,label:"L#",atomList:new A.default.AtomList({notList:"not-list"===t.type,ids:t.values.map(function(t){return j.default.map[t]})})}}function f(t){return{primary:(1&(t||0))>0,secondary:(2&(t||0))>0}}function p(t){return(t.primary&&1)+(t.secondary&&2)}function d(t){for(var e=[],n=0;n<32;n++)if(t&1<<n){var r=n+1;e.push(r)}return e}function h(t){var e=0;return t.forEach(function(t){e|=1<<t-1}),e}function m(t){return{type:b(t.type,t.stereo),topology:t.topology||0,center:t.reactingCenterStatus||0}}function g(t){return S({topology:t.topology,reactingCenterStatus:t.center},v(t.type))}function v(t){return Object.assign({},T[t])}function b(t,e){for(var n in T)if(T[n].type===t&&T[n].stereo===e)return n;throw"No such bond caption"}function y(t){var e=t.type||"GEN",n=t.attrs,r=n.context,o=n.fieldName,i=n.fieldValue,a=n.absolute,s=n.attached;return t.attrs.radiobuttons=!1===a&&!1===s?"Relative":s?"Attached":"Absolute",P.sdataSchema[r][o]&&P.sdataSchema[r][o].properties.fieldValue.items&&(t.attrs.fieldValue=i.split("\n")),Object.assign({type:e},t.attrs)}function _(t){var e=t.type,n=t.radiobuttons,r=o(t,["type","radiobuttons"]),i=S({},r);switch(n){case"Absolute":i.absolute=!0,i.attached=!1;break;case"Attached":i.absolute=!1,i.attached=!0;break;case"Relative":i.absolute=!1,i.attached=!1}return i.fieldName&&(i.fieldName=i.fieldName.trim()),i.fieldValue&&(i.fieldValue="string"==typeof i.fieldValue?i.fieldValue.trim():i.fieldValue),{type:e,attrs:i}}Object.defineProperty(n,"__esModule",{value:!0});var x=t("lodash/fp/capitalize"),w=r(x),S=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.fromElement=i,n.toElement=a,n.fromBond=m,n.toBond=g,n.toBondType=v,n.fromSgroup=y,n.toSgroup=_;var O=t("../chem/struct"),A=r(O),E=t("../chem/element"),j=r(E),P=t("./data/sdata-schema"),T={single:{type:A.default.Bond.PATTERN.TYPE.SINGLE,stereo:A.default.Bond.PATTERN.STEREO.NONE},up:{type:A.default.Bond.PATTERN.TYPE.SINGLE,stereo:A.default.Bond.PATTERN.STEREO.UP},down:{type:A.default.Bond.PATTERN.TYPE.SINGLE,stereo:A.default.Bond.PATTERN.STEREO.DOWN},updown:{type:A.default.Bond.PATTERN.TYPE.SINGLE,stereo:A.default.Bond.PATTERN.STEREO.EITHER},double:{type:A.default.Bond.PATTERN.TYPE.DOUBLE,stereo:A.default.Bond.PATTERN.STEREO.NONE},crossed:{type:A.default.Bond.PATTERN.TYPE.DOUBLE,stereo:A.default.Bond.PATTERN.STEREO.CIS_TRANS},triple:{type:A.default.Bond.PATTERN.TYPE.TRIPLE,stereo:A.default.Bond.PATTERN.STEREO.NONE},aromatic:{type:A.default.Bond.PATTERN.TYPE.AROMATIC,stereo:A.default.Bond.PATTERN.STEREO.NONE},singledouble:{type:A.default.Bond.PATTERN.TYPE.SINGLE_OR_DOUBLE,stereo:A.default.Bond.PATTERN.STEREO.NONE},singlearomatic:{type:A.default.Bond.PATTERN.TYPE.SINGLE_OR_AROMATIC,stereo:A.default.Bond.PATTERN.STEREO.NONE},doublearomatic:{type:A.default.Bond.PATTERN.TYPE.DOUBLE_OR_AROMATIC,stereo:A.default.Bond.PATTERN.STEREO.NONE},any:{type:A.default.Bond.PATTERN.TYPE.ANY,stereo:A.default.Bond.PATTERN.STEREO.NONE}}},{"../chem/element":516,"../chem/struct":533,"./data/sdata-schema":608,"lodash/fp/capitalize":421}],647:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n=t.trim();if(-1!==n.indexOf("$RXN"))return"rxn";var r=n.match(/^(M END|\$END MOL)$/m);if(r){var o=r.index+r[0].length;if(o===n.length||-1!==n.slice(o,o+20).search(/^\$(MOL|END CTAB)$/m))return"mol"}return"<"===n[0]&&-1!==n.indexOf("<molecule")?"cml":"InChI"===n.slice(0,5)?"inchi":-1===n.indexOf("\n")?"smiles":e?null:"mol"}function i(t,e,n,r){return console.assert(p[e],"No such format"),new Promise(function(o,i){var a=c.default.stringify(t);o("mol"===e||"rxn"===e?a:n.then(function(){return n.convert({struct:a,output_format:p[e].mime},r)},function(){if("smiles"===e)return f.default.stringify(t);throw Error(p[e].name+" is not supported in the standalone mode")}).then(function(t){return t.struct||t}))})}function a(t,e,n,r){return new Promise(function(i,a){var s=o(t);if(console.assert(p[s],"No such format"),"mol"===s||"rxn"===s){i(c.default.parse(t,e))}else{var u=p[s].supportsCoords;i(n.then(function(){return u?n.convert({struct:t,output_format:p.mol.mime},r):n.layout({struct:t.trim(),output_format:p.mol.mime},r)},function(){throw Error(p[s].name+" is not supported in the standalone mode")}).then(function(t){var e=c.default.parse(t.struct);return u||e.rescale(),e}))}})}function s(t,e){if("inchi"===e){if(0!==t.rgroups.count())throw"R-group fragments are not supported and will be discarded";t=t.clone(),t.sgroups.each(function(t,e){if("MUL"!==e.type&&!/^INDIGO_.+_DESC$/i.test(e.data.fieldName))throw Error("InChi data format doesn't support s-groups")})}}Object.defineProperty(n,"__esModule",{value:!0}),n.map=void 0,n.guess=o,n.toString=i,n.fromString=a,n.couldBeSaved=s;var u=t("../chem/molfile"),c=r(u),l=t("../chem/smiles"),f=r(l),p=n.map={mol:{name:"MDL Molfile",mime:"chemical/x-mdl-molfile",ext:[".mol"],supportsCoords:!0},rxn:{name:"MDL Rxnfile",mime:"chemical/x-mdl-rxnfile",ext:[".rxn"],supportsCoords:!0},cml:{name:"CML",mime:"chemical/x-cml",ext:[".cml",".mrv"],supportsCoords:!0},smiles:{name:"Daylight SMILES",mime:"chemical/x-daylight-smiles",ext:[".smi",".smiles"]},smarts:{name:"Daylight SMARTS",mime:"chemical/x-daylight-smarts",ext:[".smarts"]},inchi:{name:"InChI String",mime:"chemical/x-inchi",ext:[".inchi"]}}},{"../chem/molfile":519,"../chem/smiles":528}],648:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.atom={title:"Atom",type:"object",required:"label",properties:{label:{title:"Label",type:"string",maxLength:3,invalidMessage:"Wrong label"},alias:{title:"Alias",type:"string",invalidMessage:"Leading and trailing spaces are not allowed"},charge:{title:"Charge",type:"integer",minimum:-1e3,maximum:1e3,default:0},explicitValence:{title:"Valence",enum:[-1,0,1,2,3,4,5,6,7,8],enumNames:["","0","I","II","III","IV","V","VI","VII","VIII"],default:-1},isotope:{title:"Isotope",type:"integer",minimum:0,default:0},radical:{title:"Radical",enum:[0,2,1,3],enumNames:["","Monoradical","Diradical (singlet)","Diradical (triplet)"],default:0},ringBondCount:{title:"Ring bond count",enum:[0,-2,-1,2,3,4],enumNames:["","As drawn","0","2","3","4"],default:0},hCount:{title:"H count",enum:[0,1,2,3,4,5],enumNames:["","0","1","2","3","4"],default:0},substitutionCount:{title:"Substitution count",enum:[0,-2,-1,1,2,3,4,5,6],enumNames:["","As drawn","0","1","2","3","4","5","6"],default:0},unsaturatedAtom:{title:"Unsaturated",type:"boolean",default:!1},invRet:{title:"Inversion",enum:[0,1,2],enumNames:["","Inverts","Retains"],default:0},exactChangeFlag:{title:"Exact change",type:"boolean",default:!1}}},n.attachmentPoints={title:"Attachment Points",type:"object",properties:{primary:{title:"Primary attachment point",type:"boolean"},secondary:{title:"Secondary attachment point",type:"boolean"}}},n.bond={title:"Bond",type:"object",required:["type"],properties:{type:{title:"Type",enum:["single","up","down","updown","double","crossed","triple","aromatic","any","singledouble","singlearomatic","doublearomatic"],enumNames:["Single","Single Up","Single Down","Single Up/Down","Double","Double Cis/Trans","Triple","Aromatic","Any","Single/Double","Single/Aromatic","Double/Aromatic"],default:"single"},topology:{title:"Topology",enum:[0,1,2],enumNames:["Either","Ring","Chain"],default:0},center:{title:"Reacting Center",enum:[0,-1,1,2,4,8,12],enumNames:["Unmarked","Not center","Center","No change","Made/broken","Order changes","Made/broken and changes"],default:0}}},n.sgroup={title:"SGroup",type:"object",required:["type"],oneOf:[{key:"GEN",title:"Generic",properties:{type:{enum:["GEN"]}}},{key:"MUL",title:"Multiple group",type:"object",properties:{type:{enum:["MUL"]},mul:{title:"Repeat count",type:"integer",default:1,minimum:1,maximum:1e3,invalidMessage:"Value out of range: must be between 1 and 1000"}},required:["mul"]},{key:"SRU",title:"SRU polymer",properties:{type:{enum:["SRU"]},subscript:{title:"Polymer label",type:"string",default:"n",pattern:"^[a-zA-Z]$",invalidMessage:"SRU subscript should consist of a single letter"},connectivity:{title:"Repeat Pattern",enum:["ht","hh","eu"],enumNames:["Head-to-tail","Head-to-head","Either unknown"],default:"ht"}},required:["subscript","connectivity"]},{key:"SUP",title:"Superatom",properties:{type:{enum:["SUP"]},name:{title:"Name",type:"string",default:"",minLength:1,invalidMessage:"Please, provide a name for the superatom"}},required:["name"]}]},n.rgroup={title:"R-Group",type:"object",properties:{range:{title:"Occurrence",type:"string",maxLength:50},resth:{title:"RestH",type:"boolean"},ifthen:{title:"Condition",type:"integer",minium:0}}}},{}],649:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function i(t){var e=t.status,n=t.onAction,r=e.zoom&&e.zoom.selected;return(0,l.h)("select",{value:r,onChange:function(t){return n(function(e){return e.zoom(parseFloat(t.target.value))})}},w.zoomList.map(function(t){return(0,l.h)("option",{value:t},(100*t).toFixed()+"%")}))}function a(t,e){var n=e.active,r=e.onAction,i=(o(e,["active","onAction"]),n&&"atom"===n.tool);return(0,l.h)("menu",null,t.map(function(t){var e=h.default.map[t],o=x.basic.indexOf(t)>-1?(0,v.shortcutStr)(x.atomCuts[t]):null;return(0,l.h)("li",{className:(0,p.default)({selected:i&&n.opts.label===t})},(0,l.h)(g.default,{el:h.default[e],shortcut:o,onClick:function(){return r({tool:"atom",opts:{label:t}})}}))}))}function s(t){var e=t.active,n=t.onAction,r=(o(t,["active","onAction"]),(0,v.shortcutStr)(_.default["template-0"].shortcut)),i=e&&"template"===e.tool;return(0,l.h)("menu",null,O.default.map(function(t,o){return(0,l.h)("li",{id:"template-"+o,className:(0,p.default)({selected:i&&e.opts.struct===t})},(0,l.h)("button",{title:t.name+" ("+r+")",onClick:function(){return n({tool:"template",opts:{struct:t}})}},t.name))}))}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=t("preact-redux"),l=t("preact"),f=t("classnames"),p=r(f),d=t("../chem/element"),h=r(d),m=t("./component/atom"),g=r(m),v=t("./component/actionmenu"),b=r(v),y=t("./action"),_=r(y),x=t("./action/atoms"),w=t("./action/zoom"),S=t("./data/templates"),O=r(S),A=[{id:"document",menu:["new","open","save"]},{id:"edit",menu:["undo","redo","cut","copy","paste"]},{id:"zoom",menu:["zoom-in","zoom-out",{id:"zoom-list",component:i}]},{id:"process",menu:["layout","clean","arom","dearom","cip","check","analyse","recognize","miew"]},{id:"meta",menu:["settings","help","about"]}],E=[{id:"select",menu:["select-lasso","select-rectangle","select-fragment"]},"erase",{id:"bond",menu:[{id:"bond-common",menu:["bond-single","bond-double","bond-triple"]},{id:"bond-stereo",menu:["bond-up","bond-down","bond-updown","bond-crossed"]},{id:"bond-query",menu:["bond-any","bond-aromatic","bond-singledouble","bond-singlearomatic","bond-doublearomatic"]}]},"chain",{id:"charge",menu:["charge-plus","charge-minus"]},{id:"transform",menu:["transform-rotate","transform-flip-h","transform-flip-v"]},"sgroup","sgroup-data",{id:"reaction",menu:["reaction-arrow","reaction-plus","reaction-automap","reaction-map","reaction-unmap"]},{id:"rgroup",menu:["rgroup-label","rgroup-fragment","rgroup-attpoints"]}],j=[{id:"template-common",component:s},"template-lib","chiral-flag"],P=[{id:"atom",component:function(t){return a(x.basic,t)}},{id:"freq-atoms",component:function(t){return a(t.freqAtoms,t)}},"period-table"],T=[{id:"mainmenu",menu:A},{id:"toolbox",menu:E},{id:"template",menu:j},{id:"elements",menu:P}];n.default=(0,c.connect)(function(t,e){return{active:t.actionState&&t.actionState.activeTool,status:t.actionState||{},freqAtoms:t.toolbar.freqAtoms,opened:t.toolbar.opened,visibleTools:t.toolbar.visibleTools}},{onOpen:function(t){return{type:"OPENED",data:t}}})(function(t){return(0,l.h)(b.default,u({menu:T,role:"toolbar"},t))})},{"../chem/element":516,"./action":583,"./action/atoms":581,"./action/zoom":587,"./component/actionmenu":590,"./component/atom":591,"./data/templates":609,classnames:2,preact:483,"preact-redux":482}],650:[function(t,e,n){"use strict";function r(t,e){var n=t.properties[e];return n.constant||n.enum[0]}function o(t,e){return console.assert(t.oneOf),t.oneOf.reduce(function(t,n){return t[r(n,e)]=n,t},{})}function i(t,e){var n=t.properties&&t.properties[e];return n?n.enum.map(function(t,e){var r=n.enumNames&&n.enumNames[e];return r?{title:r,value:t}:t}):t.oneOf.map(function(t){return t.title?{title:t.title,value:r(t,e)}:r(t,e)})}var a={warningMessage:"Your changes will be lost after the tab closing. See Help (Note 2).",isAvailable:function(){try{return localStorage}catch(t){return!1}},getItem:function(t){var e=null;try{e=JSON.parse(localStorage.getItem(t))}catch(t){console.info("LocalStorage:",t.name)}return e},setItem:function(t,e){var n=null;try{localStorage.setItem(t,JSON.stringify(e)),n=!0}catch(t){console.info("LocalStorage:",t.name),n=!1}return n}};e.exports={mapOf:o,selectListOf:i,storage:a}},{}],651:[function(t,e,n){"use strict";function r(){1==arguments.length&&"min"in arguments[0]&&"max"in arguments[0]&&(this.p0=arguments[0].min,this.p1=arguments[0].max),2==arguments.length?(this.p0=arguments[0],this.p1=arguments[1]):4==arguments.length?(this.p0=new o(arguments[0],arguments[1]),this.p1=new o(arguments[2],arguments[3])):0==arguments.length?(this.p0=new o,this.p1=new o):new Error("Box2Abs constructor only accepts 4 numbers or 2 vectors or no arguments!")}var o=t("./vec2");r.prototype.toString=function(){return this.p0.toString()+" "+this.p1.toString()},r.fromRelBox=function(t){return console.assert(!!t),new r(t.x,t.y,t.x+t.width,t.y+t.height)},r.prototype.clone=function(){return new r(this.p0,this.p1)},r.union=function(t,e){return console.assert(!!t),console.assert(!!e),new r(o.min(t.p0,e.p0),o.max(t.p1,e.p1))},r.prototype.extend=function(t,e){return console.assert(!!t),e=e||t,new r(this.p0.sub(t),this.p1.add(e))},r.prototype.include=function(t){return console.assert(!!t),new r(this.p0.min(t),this.p1.max(t))},r.prototype.contains=function(t,e){return e=(e||0)-0,console.assert(!!t),t.x>=this.p0.x-e&&t.x<=this.p1.x+e&&t.y>=this.p0.y-e&&t.y<=this.p1.y+e},r.prototype.translate=function(t){return console.assert(!!t),new r(this.p0.add(t),this.p1.add(t))},r.prototype.transform=function(t,e){return console.assert(!!t),new r(t(this.p0,e),t(this.p1,e))},r.prototype.sz=function(){return this.p1.sub(this.p0)},r.prototype.centre=function(){return o.centre(this.p0,this.p1)},r.prototype.pos=function(){return this.p0},e.exports=r},{"./vec2":657}],652:[function(t,e,n){"use strict";var r={Fragment:"Fragment",Multifragment:"Multifragment",Bond:"Bond",Atom:"Atom",Group:"Group"};e.exports={SgContexts:r}},{}],653:[function(t,e,n){"use strict";function r(t){if(void 0!==t&&t.constructor!==Object)throw Error('Passed object is not an instance of "Object"!');this._obj=t||{},this._count=0}r.prototype.each=function(t,e){var n,r,o;for(n in this._obj)o=parseInt(n,10),r=this._obj[n],isNaN(o)||(n=o),t.call(e,n,r)},r.prototype.map=function(t,e){var n=new r;return this.each(function(r,o){n.set(r,t.call(e,r,o))},this),n},r.prototype.find=function(t,e){var n,r,o;for(n in this._obj)if(r=parseInt(n,10),o=this._obj[n],isNaN(r)||(n=r),t.call(e,n,o))return n},r.prototype.findAll=function(t,e){var n,r,o,i=[];for(n in this._obj)r=parseInt(n,10),o=this._obj[n],isNaN(r)||(n=r),t.call(e,n,o)&&i.push(n);return i},r.prototype.keys=function(){var t,e=[];for(t in this._obj)e.push(t);return e},r.prototype.ikeys=function(){var t=[];for(var e in this._obj)t.push(e-0);return t},r.prototype.values=function(){var t=[];for(var e in this._obj)t.push(this._obj[e]);return t},r.prototype.set=function(t,e){var n;return this._count+=(void 0!==e?1:0)-(void 0!==this._obj[t]?1:0),void 0===e?(n=this._obj[t],delete this._obj[t],n):(this._obj[t]=e,e)},r.prototype.get=function(t){if(this._obj[t]!==Object.prototype[t])return this._obj[t]},r.prototype.has=function(t){return this._obj[t]!==Object.prototype[t]},r.prototype.unset=function(t){return this.set(t,void 0)},r.prototype.update=function(t){for(var e in t)this.set(e,t[e])},r.prototype.clear=function(){this._obj={},this._count=0},r.prototype.count=function(){return this._count},r.prototype.idList=function(){return Object.keys(this._obj)},r.prototype.keyOf=function(t){for(var e in this._obj)if(this._obj[e]===t)return e},e.exports=r},{}],654:[function(t,e,n){"use strict";function r(){this._map=new o,this._nextId=0}var o=t("./map.js");r.prototype.newId=function(){return this._nextId++},r.prototype.add=function(t){var e=this._nextId++;return this._map.set(e,t),e},r.prototype.set=function(t,e){this._map.set(t,e)},r.prototype.get=function(t){return this._map.get(t)},r.prototype.has=function(t){return this._map.has(t)},r.prototype.remove=function(t){return this._map.unset(t)},r.prototype.clear=function(){this._map.clear()},r.prototype.keys=function(){return this._map.keys()},r.prototype.ikeys=function(){return this._map.ikeys()},r.prototype.values=function(){return this._map.values()},r.prototype.each=function(t,e){this._map.each(t,e)},r.prototype.map=function(t,e){return this._map.map(t,e)},r.prototype.find=function(t,e){return this._map.find(t,e)},r.prototype.count=function(){return this._map.count()},r.prototype.keyOf=function(t){return this._map.keyOf(t)},e.exports=r},{"./map.js":653}],655:[function(t,e,n){"use strict";function r(t,e){return t.scaled(1/e.scale)}function o(t,e){return t.scaled(e.scale)}e.exports={scaled2obj:r,obj2scaled:o}},{}],656:[function(t,e,n){"use strict";var r={empty:function(){return{}},single:function(t){var e={};return r.add(e,t),e},size:function(t){var e=0;for(var n in t)t[n]!==Object.prototype[n]&&e++;return e},contains:function(t,e){return void 0!==t[e]&&t[e]!==Object.prototype[e]},subset:function(t,e){for(var n in t)if(t[n]!==Object.prototype[n]&&e[n]!==t[n])return!1;return!0},intersection:function(t,e){var n={};for(var o in t)t[o]!==Object.prototype[o]&&e[o]===t[o]&&r.add(n,o);return n},disjoint:function(t,e){for(var n in t)if(t[n]!==Object.prototype[n]&&e[n]===t[n])return!1;return!0},eq:function(t,e){return r.subset(t,e)&&r.subset(e,t)},each:function(t,e,n){for(var r in t)t[r]!==Object.prototype[r]&&e.call(n,t[r])},filter:function(t,e,n){var r={};for(var o in t)t[o]!==Object.prototype[o]&&e.call(n,t[o])&&(r[t[o]]=t[o]);return r},pick:function(t){for(var e in t)if(t[e]!==Object.prototype[e])return t[e];return null},list:function(t){var e=[];for(var n in t)t[n]!==Object.prototype[n]&&e.push(t[n]);return e},add:function(t,e){t[e]=e},mergeIn:function(t,e){r.each(e,function(e){r.add(t,e)})},remove:function(t,e){var n=t[e];return delete t[e],n},clone:function(t){var e={};return r.mergeIn(e,t),e},fromList:function(t){var e={};if(t)for(var n=0;n<t.length;++n)e[t[n]-0]=t[n]-0;return e},keySetInt:function(t){var e={};return t.each(function(t){e[t-0]=t-0}),e},find:function(t,e,n){for(var r in t)if(t[r]!==Object.prototype[r]&&e.call(n,t[r]))return r;return null}};e.exports=r},{}],657:[function(t,e,n){"use strict";function r(t,e,n){if(0==arguments.length)this.x=0,this.y=0,this.z=0;else if(1==arguments.length)this.x=parseFloat(t.x||0),this.y=parseFloat(t.y||0),this.z=parseFloat(t.z||0);else if(2==arguments.length)this.x=parseFloat(t||0),this.y=parseFloat(e||0),this.z=0;else{if(3!=arguments.length)throw new Error("Vec2(): invalid arguments");this.x=parseFloat(t),this.y=parseFloat(e),this.z=parseFloat(n)}}r.ZERO=new r(0,0),r.UNIT=new r(1,1),r.segmentIntersection=function(t,e,n,r){var o=(t.x-n.x)*(e.y-n.y)-(t.y-n.y)*(e.x-n.x),i=(t.x-r.x)*(e.y-r.y)-(t.y-r.y)*(e.x-r.x),a=(n.x-t.x)*(r.y-t.y)-(n.y-t.y)*(r.x-t.x),s=(n.x-e.x)*(r.y-e.y)-(n.y-e.y)*(r.x-e.x);return o*i<=0&&a*s<=0},r.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},r.prototype.equals=function(t){return console.assert(!!t),this.x==t.x&&this.y==t.y},r.prototype.add=function(t){return console.assert(!!t),new r(this.x+t.x,this.y+t.y,this.z+t.z)},r.prototype.add_=function(t){console.assert(!!t),this.x+=t.x,this.y+=t.y,this.z+=t.z},r.prototype.get_xy0=function(){return new r(this.x,this.y)},r.prototype.sub=function(t){return console.assert(!!t),new r(this.x-t.x,this.y-t.y,this.z-t.z)},r.prototype.scaled=function(t){return console.assert(0==t||!!t),new r(this.x*t,this.y*t,this.z*t)},r.prototype.negated=function(){return new r(-this.x,-this.y,-this.z)},r.prototype.yComplement=function(t){return t=t||0,new r(this.x,t-this.y,this.z)},r.prototype.addScaled=function(t,e){return console.assert(!!t),console.assert(0==e||!!e),new r(this.x+t.x*e,this.y+t.y*e,this.z+t.z*e)},r.prototype.normalized=function(){return this.scaled(1/this.length())},r.prototype.normalize=function(){var t=this.length();return!(t<1e-6)&&(this.x/=t,this.y/=t,!0)},r.prototype.turnLeft=function(){return new r(-this.y,this.x,this.z)},r.prototype.coordStr=function(){return this.x.toString()+" , "+this.y.toString()},r.prototype.toString=function(){return"("+this.x.toFixed(2)+","+this.y.toFixed(2)+")"},r.dist=function(t,e){return console.assert(!!t),console.assert(!!e),r.diff(t,e).length()},r.max=function(t,e){return console.assert(!!t),console.assert(!!e),new r(Math.max(t.x,e.x),Math.max(t.y,e.y),Math.max(t.z,e.z))},r.min=function(t,e){return console.assert(!!t),console.assert(!!e),new r(Math.min(t.x,e.x),Math.min(t.y,e.y),Math.min(t.z,e.z))},r.prototype.max=function(t){return console.assert(!!t),new r.max(this,t)},r.prototype.min=function(t){return console.assert(!!t),new r.min(this,t)},r.prototype.ceil=function(){return new r(Math.ceil(this.x),Math.ceil(this.y),Math.ceil(this.z))},r.prototype.floor=function(){return new r(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))},r.sum=function(t,e){return console.assert(!!t),console.assert(!!e),new r(t.x+e.x,t.y+e.y,t.z+e.z)},r.dot=function(t,e){return console.assert(!!t),console.assert(!!e),t.x*e.x+t.y*e.y},r.cross=function(t,e){return console.assert(!!t),console.assert(!!e),t.x*e.y-t.y*e.x},r.prototype.rotate=function(t){console.assert(0==t||!!t);var e=Math.sin(t),n=Math.cos(t);return this.rotateSC(e,n)},r.prototype.rotateSC=function(t,e){return console.assert(0==t||!!t),console.assert(0==e||!!e),new r(this.x*e-this.y*t,this.x*t+this.y*e,this.z)},r.angle=function(t,e){return console.assert(!!t),console.assert(!!e),Math.atan2(r.cross(t,e),r.dot(t,e))},r.prototype.oxAngle=function(){return Math.atan2(this.y,this.x)},r.diff=function(t,e){return console.assert(!!t),console.assert(!!e),new r(t.x-e.x,t.y-e.y,t.z-e.z)},r.lc=function(){for(var t=new r,e=0;e<arguments.length/2;++e)t=t.addScaled(arguments[2*e],arguments[2*e+1]);return t},r.lc2=function(t,e,n,o){return console.assert(!!t),console.assert(!!n),console.assert(0==e||!!e),console.assert(0==o||!!o),new r(t.x*e+n.x*o,t.y*e+n.y*o,t.z*e+n.z*o)},r.centre=function(t,e){return new r.lc2(t,.5,e,.5)},r.shiftRayBox=function(t,e,n){console.assert(!!t),console.assert(!!e),console.assert(!!n)
;var o=[n.p0,new r(n.p1.x,n.p0.y),n.p1,new r(n.p0.x,n.p1.y)],i=o.map(function(e){return e.sub(t)});e=e.normalized();for(var a=i.map(function(t){return r.cross(t,e)}),s=i.map(function(t){return r.dot(t,e)}),u=-1,c=-1,l=0;l<4;++l)a[l]>0?(u<0||s[u]<s[l])&&(u=l):(c<0||s[c]<s[l])&&(c=l);if(c<0||u<0)return 0;var f,p;return s[u]>s[c]?(f=c,p=u):(f=u,p=c),s[f]+Math.abs(a[f])*(s[p]-s[f])/(Math.abs(a[f])+Math.abs(a[p]))},e.exports=r},{}],658:[function(t,e,n){(function(n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t){return t&&t.__esModule?t:{default:t}}function i(){return b.stringify(E.editor.struct(),{ignoreErrors:!0})}function a(){var t=E.editor.struct();return _.toString(t,"smiles",E.server)}function s(){return g.stringify(E.editor.struct(),{ignoreErrors:!0})}function u(t){"string"==typeof t&&E.ui.load(t,{rescale:!0})}function c(t){"string"==typeof t&&E.ui.load(t,{rescale:!0,fragment:!0})}function l(t,e,n){var r=new O.default(t,Object.assign({scale:n.bondLength||75},n));if(e){var o=g.parse(e);r.setMolecule(o)}return r.update(),r}t("core-js/modules/es6.typed.array-buffer"),t("core-js/modules/es6.typed.int8-array"),t("core-js/modules/es6.typed.uint8-array"),t("core-js/modules/es6.typed.uint8-clamped-array"),t("core-js/modules/es6.typed.int16-array"),t("core-js/modules/es6.typed.uint16-array"),t("core-js/modules/es6.typed.int32-array"),t("core-js/modules/es6.typed.uint32-array"),t("core-js/modules/es6.typed.float32-array"),t("core-js/modules/es6.typed.float64-array"),t("core-js/modules/es6.map"),t("core-js/modules/es6.set"),t("core-js/modules/es6.weak-map"),t("core-js/modules/es6.weak-set"),t("core-js/modules/es6.reflect.apply"),t("core-js/modules/es6.reflect.construct"),t("core-js/modules/es6.reflect.define-property"),t("core-js/modules/es6.reflect.delete-property"),t("core-js/modules/es6.reflect.get"),t("core-js/modules/es6.reflect.get-own-property-descriptor"),t("core-js/modules/es6.reflect.get-prototype-of"),t("core-js/modules/es6.reflect.has"),t("core-js/modules/es6.reflect.is-extensible"),t("core-js/modules/es6.reflect.own-keys"),t("core-js/modules/es6.reflect.prevent-extensions"),t("core-js/modules/es6.reflect.set"),t("core-js/modules/es6.reflect.set-prototype-of"),t("core-js/modules/es6.promise"),t("core-js/modules/es6.symbol"),t("core-js/modules/es6.object.assign"),t("core-js/modules/es6.object.is"),t("core-js/modules/es6.object.set-prototype-of"),t("core-js/modules/es6.function.name"),t("core-js/modules/es6.string.raw"),t("core-js/modules/es6.string.from-code-point"),t("core-js/modules/es6.string.code-point-at"),t("core-js/modules/es6.string.repeat"),t("core-js/modules/es6.string.starts-with"),t("core-js/modules/es6.string.ends-with"),t("core-js/modules/es6.string.includes"),t("core-js/modules/es6.regexp.flags"),t("core-js/modules/es6.regexp.match"),t("core-js/modules/es6.regexp.replace"),t("core-js/modules/es6.regexp.split"),t("core-js/modules/es6.regexp.search"),t("core-js/modules/es6.array.from"),t("core-js/modules/es6.array.of"),t("core-js/modules/es6.array.copy-within"),t("core-js/modules/es6.array.find"),t("core-js/modules/es6.array.find-index"),t("core-js/modules/es6.array.fill"),t("core-js/modules/es6.array.iterator"),t("core-js/modules/es6.number.is-finite"),t("core-js/modules/es6.number.is-integer"),t("core-js/modules/es6.number.is-safe-integer"),t("core-js/modules/es6.number.is-nan"),t("core-js/modules/es6.number.epsilon"),t("core-js/modules/es6.number.min-safe-integer"),t("core-js/modules/es6.number.max-safe-integer"),t("core-js/modules/es6.math.acosh"),t("core-js/modules/es6.math.asinh"),t("core-js/modules/es6.math.atanh"),t("core-js/modules/es6.math.cbrt"),t("core-js/modules/es6.math.clz32"),t("core-js/modules/es6.math.cosh"),t("core-js/modules/es6.math.expm1"),t("core-js/modules/es6.math.fround"),t("core-js/modules/es6.math.hypot"),t("core-js/modules/es6.math.imul"),t("core-js/modules/es6.math.log1p"),t("core-js/modules/es6.math.log10"),t("core-js/modules/es6.math.log2"),t("core-js/modules/es6.math.sign"),t("core-js/modules/es6.math.sinh"),t("core-js/modules/es6.math.tanh"),t("core-js/modules/es6.math.trunc"),t("core-js/modules/es7.array.includes"),t("core-js/modules/es7.object.values"),t("core-js/modules/es7.object.entries"),t("core-js/modules/es7.object.get-own-property-descriptors"),t("core-js/modules/es7.string.pad-start"),t("core-js/modules/es7.string.pad-end"),t("core-js/modules/web.timers"),t("core-js/modules/web.immediate"),t("core-js/modules/web.dom.iterable"),t("regenerator-runtime/runtime"),t("whatwg-fetch");var f=t("query-string"),p=o(f),d=t("./api.js"),h=o(d),m=t("./chem/molfile"),g=r(m),v=t("./chem/smiles"),b=r(v),y=t("./ui/structformat"),_=r(y),x=t("./ui"),w=o(x),S=t("./render"),O=o(S);window.onload=function(){var t=p.default.parse(document.location.search);t.api_path&&(E.apiPath=t.api_path);var e=document.location.href.split("/static/")[0];fetch(e+"?getMLServerPath=true",{method:"GET",credentials:"same-origin",headers:{Accept:"application/json"}}).then(function(e){e.ok&&e.json().then(function(e){E.apiPath=e.mlServerPath,E.server=(0,h.default)(E.apiPath,{"smart-layout":!0,"ignore-stereochemistry-errors":!0,"mass-skip-error-on-pseudoatoms":!1,"gross-formula-add-rsites":!0}),E.ui=(0,w.default)(Object.assign({},t,A),E.server),E.editor=n._ui_editor,E.server.then(function(){t.mol&&E.ui.load(t.mol)},function(){document.title+=" (standalone)"})})})};var A={version:"2.0.0-alpha.9",apiPath:"http://localhost:8080",buildDate:"Fri Nov 17 2017 16:21:11 GMT+0100 (CET)",buildNumber:null,buildOptions:"__BUILD_OPTIONS__",miewPath:null},E=e.exports=Object.assign({getSmiles:i,saveSmiles:a,getMolfile:s,setMolecule:u,addFragment:c,showMolfile:l},A)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./api.js":515,"./chem/molfile":519,"./chem/smiles":528,"./render":565,"./ui":633,"./ui/structformat":647,"core-js/modules/es6.array.copy-within":107,"core-js/modules/es6.array.fill":108,"core-js/modules/es6.array.find":110,"core-js/modules/es6.array.find-index":109,"core-js/modules/es6.array.from":111,"core-js/modules/es6.array.iterator":112,"core-js/modules/es6.array.of":113,"core-js/modules/es6.function.name":114,"core-js/modules/es6.map":115,"core-js/modules/es6.math.acosh":116,"core-js/modules/es6.math.asinh":117,"core-js/modules/es6.math.atanh":118,"core-js/modules/es6.math.cbrt":119,"core-js/modules/es6.math.clz32":120,"core-js/modules/es6.math.cosh":121,"core-js/modules/es6.math.expm1":122,"core-js/modules/es6.math.fround":123,"core-js/modules/es6.math.hypot":124,"core-js/modules/es6.math.imul":125,"core-js/modules/es6.math.log10":126,"core-js/modules/es6.math.log1p":127,"core-js/modules/es6.math.log2":128,"core-js/modules/es6.math.sign":129,"core-js/modules/es6.math.sinh":130,"core-js/modules/es6.math.tanh":131,"core-js/modules/es6.math.trunc":132,"core-js/modules/es6.number.epsilon":133,"core-js/modules/es6.number.is-finite":134,"core-js/modules/es6.number.is-integer":135,"core-js/modules/es6.number.is-nan":136,"core-js/modules/es6.number.is-safe-integer":137,"core-js/modules/es6.number.max-safe-integer":138,"core-js/modules/es6.number.min-safe-integer":139,"core-js/modules/es6.object.assign":140,"core-js/modules/es6.object.is":141,"core-js/modules/es6.object.set-prototype-of":142,"core-js/modules/es6.promise":143,"core-js/modules/es6.reflect.apply":144,"core-js/modules/es6.reflect.construct":145,"core-js/modules/es6.reflect.define-property":146,"core-js/modules/es6.reflect.delete-property":147,"core-js/modules/es6.reflect.get":150,"core-js/modules/es6.reflect.get-own-property-descriptor":148,"core-js/modules/es6.reflect.get-prototype-of":149,"core-js/modules/es6.reflect.has":151,"core-js/modules/es6.reflect.is-extensible":152,"core-js/modules/es6.reflect.own-keys":153,"core-js/modules/es6.reflect.prevent-extensions":154,"core-js/modules/es6.reflect.set":156,"core-js/modules/es6.reflect.set-prototype-of":155,"core-js/modules/es6.regexp.flags":157,"core-js/modules/es6.regexp.match":158,"core-js/modules/es6.regexp.replace":159,"core-js/modules/es6.regexp.search":160,"core-js/modules/es6.regexp.split":161,"core-js/modules/es6.set":162,"core-js/modules/es6.string.code-point-at":163,"core-js/modules/es6.string.ends-with":164,"core-js/modules/es6.string.from-code-point":165,"core-js/modules/es6.string.includes":166,"core-js/modules/es6.string.raw":167,"core-js/modules/es6.string.repeat":168,"core-js/modules/es6.string.starts-with":169,"core-js/modules/es6.symbol":170,"core-js/modules/es6.typed.array-buffer":171,"core-js/modules/es6.typed.float32-array":172,"core-js/modules/es6.typed.float64-array":173,"core-js/modules/es6.typed.int16-array":174,"core-js/modules/es6.typed.int32-array":175,"core-js/modules/es6.typed.int8-array":176,"core-js/modules/es6.typed.uint16-array":177,"core-js/modules/es6.typed.uint32-array":178,"core-js/modules/es6.typed.uint8-array":179,"core-js/modules/es6.typed.uint8-clamped-array":180,"core-js/modules/es6.weak-map":181,"core-js/modules/es6.weak-set":182,"core-js/modules/es7.array.includes":183,"core-js/modules/es7.object.entries":184,"core-js/modules/es7.object.get-own-property-descriptors":185,"core-js/modules/es7.object.values":186,"core-js/modules/es7.string.pad-end":187,"core-js/modules/es7.string.pad-start":188,"core-js/modules/web.dom.iterable":189,"core-js/modules/web.immediate":190,"core-js/modules/web.timers":191,"query-string":491,"regenerator-runtime/runtime":504,"whatwg-fetch":514}]},{},[658])(658)});
//# sourceMappingURL=ketcher.js.map