godash-diagrams 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/godash-diagrams.auto.iife.js +3 -3
- package/dist/godash-diagrams.js +1483 -1484
- package/dist/godash-diagrams.umd.cjs +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(Tt,gt){typeof exports=="object"&&typeof module<"u"?gt(exports):typeof define=="function"&&define.amd?define(["exports"],gt):(Tt=typeof globalThis<"u"?globalThis:Tt||self,gt(Tt.GodashDiagrams={}))})(this,(function(Tt){"use strict";var gt="@@__IMMUTABLE_INDEXED__@@";function tt(r){return!!(r&&r[gt])}var mr="@@__IMMUTABLE_KEYED__@@";function z(r){return!!(r&&r[mr])}function Hr(r){return z(r)||tt(r)}var qi="@@__IMMUTABLE_ITERABLE__@@";function W(r){return!!(r&&r[qi])}var L=function(t){return W(t)?t:H(t)},rt=(function(r){function t(e){return z(e)?e:wt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(L),Rt=(function(r){function t(e){return tt(e)?e:it(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(L),jt=(function(r){function t(e){return W(e)&&!Hr(e)?e:Nt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(L);L.Keyed=rt,L.Indexed=Rt,L.Set=jt;var xt=0,G=1,Y=2,Kr=typeof Symbol=="function"&&Symbol.iterator,Mi="@@iterator",Sr=Kr||Mi,S=function(t){this.next=t};S.prototype.toString=function(){return"[Iterator]"},S.KEYS=xt,S.VALUES=G,S.ENTRIES=Y,S.prototype.inspect=S.prototype.toSource=function(){return this.toString()},S.prototype[Sr]=function(){return this};function C(r,t,e,n){var i=r===xt?t:r===G?e:[t,e];return n?n.value=i:n={value:i,done:!1},n}function N(){return{value:void 0,done:!0}}function Oi(r){return Array.isArray(r)?!0:!!wr(r)}function Ei(r){return!!(r&&typeof r.next=="function")}function Wr(r){var t=wr(r);return t&&t.call(r)}function wr(r){var t=r&&(Kr&&r[Kr]||r[Mi]);if(typeof t=="function")return t}function Bs(r){var t=wr(r);return t&&t===r.entries}function js(r){var t=wr(r);return t&&t===r.keys}var Vt="delete",O=5,J=1<<O,D=J-1,m={};function Gr(){return{value:!1}}function et(r){r&&(r.value=!0)}function Yr(){}function Lt(r){return r.size===void 0&&(r.size=r.__iterate(Ti)),r.size}function mt(r,t){if(typeof t!="number"){var e=t>>>0;if(""+e!==t||e===4294967295)return NaN;t=e}return t<0?Lt(r)+t:t}function Ti(){return!0}function br(r,t,e){return(r===0&&!zi(r)||e!==void 0&&r<=-e)&&(t===void 0||e!==void 0&&t>=e)}function Zt(r,t){return Ri(r,t,0)}function Ir(r,t){return Ri(r,t,t)}function Ri(r,t,e){return r===void 0?e:zi(r)?t===1/0?t:Math.max(0,t+r)|0:t===void 0||t===r?r:Math.min(t,r)|0}function zi(r){return r<0||r===0&&1/r===-1/0}var Ci="@@__IMMUTABLE_RECORD__@@";function zt(r){return!!(r&&r[Ci])}function ut(r){return W(r)||zt(r)}var St="@@__IMMUTABLE_ORDERED__@@";function ft(r){return!!(r&&r[St])}var Ai="@@__IMMUTABLE_SEQ__@@";function Jr(r){return!!(r&&r[Ai])}var Pt=Object.prototype.hasOwnProperty;function $i(r){return Array.isArray(r)||typeof r=="string"?!0:r&&typeof r=="object"&&Number.isInteger(r.length)&&r.length>=0&&(r.length===0?Object.keys(r).length===1:r.hasOwnProperty(r.length-1))}var H=(function(r){function t(e){return e==null?Vr():ut(e)?e.toSeq():Ls(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(n,i){var o=this._cache;if(o){for(var a=o.length,s=0;s!==a;){var u=o[i?a-++s:s++];if(n(u[1],u[0],this)===!1)break}return s}return this.__iterateUncached(n,i)},t.prototype.__iterator=function(n,i){var o=this._cache;if(o){var a=o.length,s=0;return new S(function(){if(s===a)return N();var u=o[i?a-++s:s++];return C(n,u[0],u[1])})}return this.__iteratorUncached(n,i)},t})(L),wt=(function(r){function t(e){return e==null?Vr().toKeyedSeq():W(e)?z(e)?e.toSeq():e.fromEntrySeq():zt(e)?e.toSeq():Zr(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t})(H),it=(function(r){function t(e){return e==null?Vr():W(e)?z(e)?e.entrySeq():e.toIndexedSeq():zt(e)?e.toSeq().entrySeq():Bi(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t})(H),Nt=(function(r){function t(e){return(W(e)&&!Hr(e)?e:it(e)).toSetSeq()}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t})(H);H.isSeq=Jr,H.Keyed=wt,H.Set=Nt,H.Indexed=it,H.prototype[Ai]=!0;var Dt=(function(r){function t(e){this._array=e,this.size=e.length}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return this.has(n)?this._array[mt(this,n)]:i},t.prototype.__iterate=function(n,i){for(var o=this._array,a=o.length,s=0;s!==a;){var u=i?a-++s:s++;if(n(o[u],u,this)===!1)break}return s},t.prototype.__iterator=function(n,i){var o=this._array,a=o.length,s=0;return new S(function(){if(s===a)return N();var u=i?a-++s:s++;return C(n,u,o[u])})},t})(it),Xr=(function(r){function t(e){var n=Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]);this._object=e,this._keys=n,this.size=n.length}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return i!==void 0&&!this.has(n)?i:this._object[n]},t.prototype.has=function(n){return Pt.call(this._object,n)},t.prototype.__iterate=function(n,i){for(var o=this._object,a=this._keys,s=a.length,u=0;u!==s;){var f=a[i?s-++u:u++];if(n(o[f],f,this)===!1)break}return u},t.prototype.__iterator=function(n,i){var o=this._object,a=this._keys,s=a.length,u=0;return new S(function(){if(u===s)return N();var f=a[i?s-++u:u++];return C(n,f,o[f])})},t})(wt);Xr.prototype[St]=!0;var xs=(function(r){function t(e){this._collection=e,this.size=e.length||e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(n,i){if(i)return this.cacheResult().__iterate(n,i);var o=this._collection,a=Wr(o),s=0;if(Ei(a))for(var u;!(u=a.next()).done&&n(u.value,s++,this)!==!1;);return s},t.prototype.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var o=this._collection,a=Wr(o);if(!Ei(a))return new S(N);var s=0;return new S(function(){var u=a.next();return u.done?u:C(n,s++,u.value)})},t})(it),ki;function Vr(){return ki||(ki=new Dt([]))}function Zr(r){var t=Qr(r);if(t)return t.fromEntrySeq();if(typeof r=="object")return new Xr(r);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+r)}function Bi(r){var t=Qr(r);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+r)}function Ls(r){var t=Qr(r);if(t)return Bs(r)?t.fromEntrySeq():js(r)?t.toSetSeq():t;if(typeof r=="object")return new Xr(r);throw new TypeError("Expected Array or collection object of values, or keyed object: "+r)}function Qr(r){return $i(r)?new Dt(r):Oi(r)?new xs(r):void 0}function Qt(){return this.__ensureOwner()}function tr(){return this.__ownerID?this:this.__ensureOwner(new Yr)}var rr=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(t,e){t|=0,e|=0;var n=t&65535,i=e&65535;return n*i+((t>>>16)*i+n*(e>>>16)<<16>>>0)|0};function qr(r){return r>>>1&1073741824|r&3221225471}var Ps=Object.prototype.valueOf;function X(r){if(r==null)return ji(r);if(typeof r.hashCode=="function")return qr(r.hashCode(r));var t=Ks(r);if(t==null)return ji(t);switch(typeof t){case"boolean":return t?1108378657:1108378656;case"number":return Ns(t);case"string":return t.length>Ws?Ds(t):te(t);case"object":case"function":return Us(t);case"symbol":return Fs(t);default:if(typeof t.toString=="function")return te(t.toString());throw new Error("Value type "+typeof t+" cannot be hashed.")}}function ji(r){return r===null?1108378658:1108378659}function Ns(r){if(r!==r||r===1/0)return 0;var t=r|0;for(t!==r&&(t^=r*4294967295);r>4294967295;)r/=4294967295,t^=r;return qr(t)}function Ds(r){var t=oe[r];return t===void 0&&(t=te(r),ie===Gs&&(ie=0,oe={}),ie++,oe[r]=t),t}function te(r){for(var t=0,e=0;e<r.length;e++)t=31*t+r.charCodeAt(e)|0;return qr(t)}function Fs(r){var t=Ni[r];return t!==void 0||(t=Pi(),Ni[r]=t),t}function Us(r){var t;if(re&&(t=ee.get(r),t!==void 0)||(t=r[Ct],t!==void 0)||!Li&&(t=r.propertyIsEnumerable&&r.propertyIsEnumerable[Ct],t!==void 0||(t=Hs(r),t!==void 0)))return t;if(t=Pi(),re)ee.set(r,t);else{if(xi!==void 0&&xi(r)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(Li)Object.defineProperty(r,Ct,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(r.propertyIsEnumerable!==void 0&&r.propertyIsEnumerable===r.constructor.prototype.propertyIsEnumerable)r.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},r.propertyIsEnumerable[Ct]=t;else if(r.nodeType!==void 0)r[Ct]=t;else throw new Error("Unable to set a non-enumerable property on object.")}return t}var xi=Object.isExtensible,Li=(function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}})();function Hs(r){if(r&&r.nodeType>0)switch(r.nodeType){case 1:return r.uniqueID;case 9:return r.documentElement&&r.documentElement.uniqueID}}function Ks(r){return r.valueOf!==Ps&&typeof r.valueOf=="function"?r.valueOf(r):r}function Pi(){var r=++ne;return ne&1073741824&&(ne=0),r}var re=typeof WeakMap=="function",ee;re&&(ee=new WeakMap);var Ni=Object.create(null),ne=0,Ct="__immutablehash__";typeof Symbol=="function"&&(Ct=Symbol(Ct));var Ws=16,Gs=255,ie=0,oe={},Mr=(function(r){function t(e,n){this._iter=e,this._useKeys=n,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return this._iter.get(n,i)},t.prototype.has=function(n){return this._iter.has(n)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var n=this,i=ae(this,!0);return this._useKeys||(i.valueSeq=function(){return n._iter.toSeq().reverse()}),i},t.prototype.map=function(n,i){var o=this,a=Ki(this,n,i);return this._useKeys||(a.valueSeq=function(){return o._iter.toSeq().map(n,i)}),a},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a,s){return n(a,s,o)},i)},t.prototype.__iterator=function(n,i){return this._iter.__iterator(n,i)},t})(wt);Mr.prototype[St]=!0;var Di=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.includes=function(n){return this._iter.includes(n)},t.prototype.__iterate=function(n,i){var o=this,a=0;return i&&Lt(this),this._iter.__iterate(function(s){return n(s,i?o.size-++a:a++,o)},i)},t.prototype.__iterator=function(n,i){var o=this,a=this._iter.__iterator(G,i),s=0;return i&&Lt(this),new S(function(){var u=a.next();return u.done?u:C(n,i?o.size-++s:s++,u.value,u)})},t})(it),Fi=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.has=function(n){return this._iter.includes(n)},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a){return n(a,a,o)},i)},t.prototype.__iterator=function(n,i){var o=this._iter.__iterator(G,i);return new S(function(){var a=o.next();return a.done?a:C(n,a.value,a.value,a)})},t})(Nt),Ui=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a){if(a){Xi(a);var s=W(a);return n(s?a.get(1):a[1],s?a.get(0):a[0],o)}},i)},t.prototype.__iterator=function(n,i){var o=this._iter.__iterator(G,i);return new S(function(){for(;;){var a=o.next();if(a.done)return a;var s=a.value;if(s){Xi(s);var u=W(s);return C(n,u?s.get(0):s[0],u?s.get(1):s[1],a)}}})},t})(wt);Di.prototype.cacheResult=Mr.prototype.cacheResult=Fi.prototype.cacheResult=Ui.prototype.cacheResult=fe;function Hi(r){var t=ct(r);return t._iter=r,t.size=r.size,t.flip=function(){return r},t.reverse=function(){var e=r.reverse.apply(this);return e.flip=function(){return r.reverse()},e},t.has=function(e){return r.includes(e)},t.includes=function(e){return r.has(e)},t.cacheResult=fe,t.__iterateUncached=function(e,n){var i=this;return r.__iterate(function(o,a){return e(a,o,i)!==!1},n)},t.__iteratorUncached=function(e,n){if(e===Y){var i=r.__iterator(e,n);return new S(function(){var o=i.next();if(!o.done){var a=o.value[0];o.value[0]=o.value[1],o.value[1]=a}return o})}return r.__iterator(e===G?xt:G,n)},t}function Ki(r,t,e){var n=ct(r);return n.size=r.size,n.has=function(i){return r.has(i)},n.get=function(i,o){var a=r.get(i,m);return a===m?o:t.call(e,a,i,r)},n.__iterateUncached=function(i,o){var a=this;return r.__iterate(function(s,u,f){return i(t.call(e,s,u,f),u,a)!==!1},o)},n.__iteratorUncached=function(i,o){var a=r.__iterator(Y,o);return new S(function(){var s=a.next();if(s.done)return s;var u=s.value,f=u[0];return C(i,f,t.call(e,u[1],f,r),s)})},n}function ae(r,t){var e=this,n=ct(r);return n._iter=r,n.size=r.size,n.reverse=function(){return r},r.flip&&(n.flip=function(){var i=Hi(r);return i.reverse=function(){return r.flip()},i}),n.get=function(i,o){return r.get(t?i:-1-i,o)},n.has=function(i){return r.has(t?i:-1-i)},n.includes=function(i){return r.includes(i)},n.cacheResult=fe,n.__iterate=function(i,o){var a=this,s=0;return o&&Lt(r),r.__iterate(function(u,f){return i(u,t?f:o?a.size-++s:s++,a)},!o)},n.__iterator=function(i,o){var a=0;o&&Lt(r);var s=r.__iterator(Y,!o);return new S(function(){var u=s.next();if(u.done)return u;var f=u.value;return C(i,t?f[0]:o?e.size-++a:a++,f[1],u)})},n}function Wi(r,t,e,n){var i=ct(r);return n&&(i.has=function(o){var a=r.get(o,m);return a!==m&&!!t.call(e,a,o,r)},i.get=function(o,a){var s=r.get(o,m);return s!==m&&t.call(e,s,o,r)?s:a}),i.__iterateUncached=function(o,a){var s=this,u=0;return r.__iterate(function(f,c,h){if(t.call(e,f,c,h))return u++,o(f,n?c:u-1,s)},a),u},i.__iteratorUncached=function(o,a){var s=r.__iterator(Y,a),u=0;return new S(function(){for(;;){var f=s.next();if(f.done)return f;var c=f.value,h=c[0],p=c[1];if(t.call(e,p,h,r))return C(o,n?h:u++,p,f)}})},i}function Ys(r,t,e){var n=B().asMutable();return r.__iterate(function(i,o){n.update(t.call(e,i,o,r),0,function(a){return a+1})}),n.asImmutable()}function Js(r,t,e){var n=z(r),i=(ft(r)?vt():B()).asMutable();r.__iterate(function(a,s){i.update(t.call(e,a,s,r),function(u){return u=u||[],u.push(n?[s,a]:a),u})});var o=ue(r);return i.map(function(a){return E(r,o(a))}).asImmutable()}function Xs(r,t,e){var n=z(r),i=[[],[]];r.__iterate(function(a,s){i[t.call(e,a,s,r)?1:0].push(n?[s,a]:a)});var o=ue(r);return i.map(function(a){return E(r,o(a))})}function se(r,t,e,n){var i=r.size;if(br(t,e,i))return r;if(typeof i>"u"&&(t<0||e<0))return se(r.toSeq().cacheResult(),t,e,n);var o=Zt(t,i),a=Ir(e,i),s=a-o,u;s===s&&(u=s<0?0:s);var f=ct(r);return f.size=u===0?u:r.size&&u||void 0,!n&&Jr(r)&&u>=0&&(f.get=function(c,h){return c=mt(this,c),c>=0&&c<u?r.get(c+o,h):h}),f.__iterateUncached=function(c,h){var p=this;if(u===0)return 0;if(h)return this.cacheResult().__iterate(c,h);var _=0,d=!0,v=0;return r.__iterate(function(w,I){if(!(d&&(d=_++<o)))return v++,c(w,n?I:v-1,p)!==!1&&v!==u}),v},f.__iteratorUncached=function(c,h){if(u!==0&&h)return this.cacheResult().__iterator(c,h);if(u===0)return new S(N);var p=r.__iterator(c,h),_=0,d=0;return new S(function(){for(;_++<o;)p.next();if(++d>u)return N();var v=p.next();return n||c===G||v.done?v:c===xt?C(c,d-1,void 0,v):C(c,d-1,v.value[1],v)})},f}function Vs(r,t,e){var n=ct(r);return n.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=0;return r.__iterate(function(u,f,c){return t.call(e,u,f,c)&&++s&&i(u,f,a)}),s},n.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=r.__iterator(Y,o),u=!0;return new S(function(){if(!u)return N();var f=s.next();if(f.done)return f;var c=f.value,h=c[0],p=c[1];return t.call(e,p,h,a)?i===Y?f:C(i,h,p,f):(u=!1,N())})},n}function Gi(r,t,e,n){var i=ct(r);return i.__iterateUncached=function(o,a){var s=this;if(a)return this.cacheResult().__iterate(o,a);var u=!0,f=0;return r.__iterate(function(c,h,p){if(!(u&&(u=t.call(e,c,h,p))))return f++,o(c,n?h:f-1,s)}),f},i.__iteratorUncached=function(o,a){var s=this;if(a)return this.cacheResult().__iterator(o,a);var u=r.__iterator(Y,a),f=!0,c=0;return new S(function(){var h,p,_;do{if(h=u.next(),h.done)return n||o===G?h:o===xt?C(o,c++,void 0,h):C(o,c++,h.value[1],h);var d=h.value;p=d[0],_=d[1],f&&(f=t.call(e,_,p,s))}while(f);return o===Y?h:C(o,p,_,h)})},i}var Zs=(function(r){function t(e){this._wrappedIterables=e.flatMap(function(n){return n._wrappedIterables?n._wrappedIterables:[n]}),this.size=this._wrappedIterables.reduce(function(n,i){if(n!==void 0){var o=i.size;if(o!==void 0)return n+o}},0),this[mr]=this._wrappedIterables[0][mr],this[gt]=this._wrappedIterables[0][gt],this[St]=this._wrappedIterables[0][St]}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(n,i){if(this._wrappedIterables.length!==0){if(i)return this.cacheResult().__iterate(n,i);for(var o=0,a=z(this),s=a?Y:G,u=this._wrappedIterables[o].__iterator(s,i),f=!0,c=0;f;){for(var h=u.next();h.done;){if(o++,o===this._wrappedIterables.length)return c;u=this._wrappedIterables[o].__iterator(s,i),h=u.next()}var p=a?n(h.value[1],h.value[0],this):n(h.value,c,this);f=p!==!1,c++}return c}},t.prototype.__iteratorUncached=function(n,i){var o=this;if(this._wrappedIterables.length===0)return new S(N);if(i)return this.cacheResult().__iterator(n,i);var a=0,s=this._wrappedIterables[a].__iterator(n,i);return new S(function(){for(var u=s.next();u.done;){if(a++,a===o._wrappedIterables.length)return u;s=o._wrappedIterables[a].__iterator(n,i),u=s.next()}return u})},t})(H);function Qs(r,t){var e=z(r),n=[r].concat(t).map(function(o){return W(o)?e&&(o=rt(o)):o=e?Zr(o):Bi(Array.isArray(o)?o:[o]),o}).filter(function(o){return o.size!==0});if(n.length===0)return r;if(n.length===1){var i=n[0];if(i===r||e&&z(i)||tt(r)&&tt(i))return i}return new Zs(n)}function Yi(r,t,e){var n=ct(r);return n.__iterateUncached=function(i,o){if(o)return this.cacheResult().__iterate(i,o);var a=0,s=!1;function u(f,c){f.__iterate(function(h,p){return(!t||c<t)&&W(h)?u(h,c+1):(a++,i(h,e?p:a-1,n)===!1&&(s=!0)),!s},o)}return u(r,0),a},n.__iteratorUncached=function(i,o){if(o)return this.cacheResult().__iterator(i,o);var a=r.__iterator(i,o),s=[],u=0;return new S(function(){for(;a;){var f=a.next();if(f.done!==!1){a=s.pop();continue}var c=f.value;if(i===Y&&(c=c[1]),(!t||s.length<t)&&W(c))s.push(a),a=c.__iterator(i,o);else return e?f:C(i,u++,c,f)}return N()})},n}function tu(r,t,e){var n=ue(r);return r.toSeq().map(function(i,o){return n(t.call(e,i,o,r))}).flatten(!0)}function ru(r,t){var e=ct(r);return e.size=r.size&&r.size*2-1,e.__iterateUncached=function(n,i){var o=this,a=0;return r.__iterate(function(s){return(!a||n(t,a++,o)!==!1)&&n(s,a++,o)!==!1},i),a},e.__iteratorUncached=function(n,i){var o=r.__iterator(G,i),a=0,s;return new S(function(){return(!s||a%2)&&(s=o.next(),s.done)?s:a%2?C(n,a++,t):C(n,a++,s.value,s)})},e}function Ft(r,t,e){t||(t=Vi);var n=z(r),i=0,o=r.toSeq().map(function(a,s){return[s,a,i++,e?e(a,s,r):a]}).valueSeq().toArray();return o.sort(function(a,s){return t(a[3],s[3])||a[2]-s[2]}).forEach(n?function(a,s){o[s].length=2}:function(a,s){o[s]=a[1]}),n?wt(o):tt(r)?it(o):Nt(o)}function Or(r,t,e){if(t||(t=Vi),e){var n=r.toSeq().map(function(i,o){return[i,e(i,o,r)]}).reduce(function(i,o){return Ji(t,i[1],o[1])?o:i});return n&&n[0]}return r.reduce(function(i,o){return Ji(t,i,o)?o:i})}function Ji(r,t,e){var n=r(e,t);return n===0&&e!==t&&(e==null||e!==e)||n>0}function Er(r,t,e,n){var i=ct(r),o=new Dt(e).map(function(a){return a.size});return i.size=n?o.max():o.min(),i.__iterate=function(a,s){for(var u=this.__iterator(G,s),f,c=0;!(f=u.next()).done&&a(f.value,c++,this)!==!1;);return c},i.__iteratorUncached=function(a,s){var u=e.map(function(h){return h=L(h),Wr(s?h.reverse():h)}),f=0,c=!1;return new S(function(){var h;return c||(h=u.map(function(p){return p.next()}),c=n?h.every(function(p){return p.done}):h.some(function(p){return p.done})),c?N():C(a,f++,t.apply(null,h.map(function(p){return p.value})))})},i}function E(r,t){return r===t?r:Jr(r)?t:r.constructor(t)}function Xi(r){if(r!==Object(r))throw new TypeError("Expected [K, V] tuple: "+r)}function ue(r){return z(r)?rt:tt(r)?Rt:jt}function ct(r){return Object.create((z(r)?wt:tt(r)?it:Nt).prototype)}function fe(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):H.prototype.cacheResult.call(this)}function Vi(r,t){return r===void 0&&t===void 0?0:r===void 0?1:t===void 0?-1:r>t?1:r<t?-1:0}function Zi(r){return!!(r&&typeof r.equals=="function"&&typeof r.hashCode=="function")}function V(r,t){if(r===t||r!==r&&t!==t)return!0;if(!r||!t)return!1;if(typeof r.valueOf=="function"&&typeof t.valueOf=="function"){if(r=r.valueOf(),t=t.valueOf(),r===t||r!==r&&t!==t)return!0;if(!r||!t)return!1}return!!(Zi(r)&&Zi(t)&&r.equals(t))}function Qi(r,t,e,n){return Kt(r,[t],e,n)}function to(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return eo(this,r)}function ro(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];if(typeof r!="function")throw new TypeError("Invalid merger function: "+r);return eo(this,t,r)}function eo(r,t,e){for(var n=[],i=0;i<t.length;i++){var o=rt(t[i]);o.size!==0&&n.push(o)}return n.length===0?r:r.toSeq().size===0&&!r.__ownerID&&n.length===1?zt(r)?r:r.constructor(n[0]):r.withMutations(function(a){for(var s=e?function(f,c){Qi(a,c,m,function(h){return h===m?f:e(h,f,c)})}:function(f,c){a.set(c,f)},u=0;u<n.length;u++)n[u].forEach(s)})}var eu=Object.prototype.toString;function nu(r){if(!r||typeof r!="object"||eu.call(r)!=="[object Object]")return!1;var t=Object.getPrototypeOf(r);if(t===null)return!0;for(var e=t,n=Object.getPrototypeOf(t);n!==null;)e=n,n=Object.getPrototypeOf(e);return e===t}function bt(r){return typeof r=="object"&&(ut(r)||Array.isArray(r)||nu(r))}function ht(r,t){t=t||0;for(var e=Math.max(0,r.length-t),n=new Array(e),i=0;i<e;i++)n[i]=r[i+t];return n}function Tr(r){if(Array.isArray(r))return ht(r);var t={};for(var e in r)Pt.call(r,e)&&(t[e]=r[e]);return t}function ce(r,t,e){return he(r,t,iu(e))}function he(r,t,e){if(!bt(r))throw new TypeError("Cannot merge into non-data-structure value: "+r);if(ut(r))return typeof e=="function"&&r.mergeWith?r.mergeWith.apply(r,[e].concat(t)):r.merge?r.merge.apply(r,t):r.concat.apply(r,t);for(var n=Array.isArray(r),i=r,o=n?Rt:rt,a=n?function(u){i===r&&(i=Tr(i)),i.push(u)}:function(u,f){var c=Pt.call(i,f),h=c&&e?e(i[f],u,f):u;(!c||h!==i[f])&&(i===r&&(i=Tr(i)),i[f]=h)},s=0;s<t.length;s++)o(t[s]).forEach(a);return i}function iu(r){function t(e,n,i){return bt(e)&&bt(n)&&ou(e,n)?he(e,[n],t):r?r(e,n,i):n}return t}function ou(r,t){var e=H(r),n=H(t);return tt(e)===tt(n)&&z(e)===z(n)}function no(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return ce(this,r)}function io(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return ce(this,t,r)}function pe(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Kt(this,r,pt(),function(n){return ce(n,t)})}function _e(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Kt(this,r,pt(),function(n){return he(n,t)})}function au(r,t,e){return Kt(r,t,m,function(){return e})}function de(r,t){return au(this,r,t)}function le(r,t,e){return arguments.length===1?r(this):Qi(this,r,t,e)}function ve(r,t,e){return Kt(this,r,t,e)}function ye(){return this.__altered}function er(r){var t=this.asMutable();return r(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}var oo="@@__IMMUTABLE_MAP__@@";function ge(r){return!!(r&&r[oo])}function nr(r,t){if(!r)throw new Error(t)}function Z(r){nr(r!==1/0,"Cannot perform this action with an infinite size.")}var B=(function(r){function t(e){return e==null?pt():ge(e)&&!ft(e)?e:pt().withMutations(function(n){var i=r(e);Z(i.size),i.forEach(function(o,a){return n.set(a,o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(n,i){return this._root?this._root.get(0,void 0,n,i):i},t.prototype.set=function(n,i){return uo(this,n,i)},t.prototype.remove=function(n){return uo(this,n,m)},t.prototype.deleteAll=function(n){var i=L(n);return i.size===0?this:this.withMutations(function(o){i.forEach(function(a){return o.remove(a)})})},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):pt()},t.prototype.sort=function(n){return vt(Ft(this,n))},t.prototype.sortBy=function(n,i){return vt(Ft(this,i,n))},t.prototype.map=function(n,i){var o=this;return this.withMutations(function(a){a.forEach(function(s,u){a.set(u,n.call(i,s,u,o))})})},t.prototype.__iterator=function(n,i){return new su(this,n,i)},t.prototype.__iterate=function(n,i){var o=this,a=0;return this._root&&this._root.iterate(function(s){return a++,n(s[1],s[0],o)},i),a},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?Se(this.size,this._root,n,this.__hash):this.size===0?pt():(this.__ownerID=n,this.__altered=!1,this)},t})(rt);B.isMap=ge;var R=B.prototype;R[oo]=!0,R[Vt]=R.remove,R.removeAll=R.deleteAll,R.setIn=de,R.removeIn=R.deleteIn=Ie,R.update=le,R.updateIn=ve,R.merge=R.concat=to,R.mergeWith=ro,R.mergeDeep=no,R.mergeDeepWith=io,R.mergeIn=_e,R.mergeDeepIn=pe,R.withMutations=er,R.wasAltered=ye,R.asImmutable=Qt,R["@@transducer/init"]=R.asMutable=tr,R["@@transducer/step"]=function(r,t){return r.set(t[0],t[1])},R["@@transducer/result"]=function(r){return r.asImmutable()};var ir=function(t,e){this.ownerID=t,this.entries=e};ir.prototype.get=function(t,e,n,i){for(var o=this.entries,a=0,s=o.length;a<s;a++)if(V(n,o[a][0]))return o[a][1];return i},ir.prototype.update=function(t,e,n,i,o,a,s){for(var u=o===m,f=this.entries,c=0,h=f.length;c<h&&!V(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===o:u)return this;if(et(s),(u||!p)&&et(a),!(u&&f.length===1)){if(!p&&!u&&f.length>=_u)return uu(t,f,i,o);var _=t&&t===this.ownerID,d=_?f:ht(f);return p?u?c===h-1?d.pop():d[c]=d.pop():d[c]=[i,o]:d.push([i,o]),_?(this.entries=d,this):new ir(t,d)}};var Ut=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n};Ut.prototype.get=function(t,e,n,i){e===void 0&&(e=X(n));var o=1<<((t===0?e:e>>>t)&D),a=this.bitmap;return(a&o)===0?i:this.nodes[co(a&o-1)].get(t+O,e,n,i)},Ut.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=X(i));var u=(e===0?n:n>>>e)&D,f=1<<u,c=this.bitmap,h=(c&f)!==0;if(!h&&o===m)return this;var p=co(c&f-1),_=this.nodes,d=h?_[p]:void 0,v=we(d,t,e+O,n,i,o,a,s);if(v===d)return this;if(!h&&v&&_.length>=du)return cu(t,_,c,u,v);if(h&&!v&&_.length===2&&fo(_[p^1]))return _[p^1];if(h&&v&&_.length===1&&fo(v))return v;var w=t&&t===this.ownerID,I=h?v?c:c^f:c|f,y=h?v?ho(_,p,v,w):pu(_,p,w):hu(_,p,v,w);return w?(this.bitmap=I,this.nodes=y,this):new Ut(t,I,y)};var or=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n};or.prototype.get=function(t,e,n,i){e===void 0&&(e=X(n));var o=(t===0?e:e>>>t)&D,a=this.nodes[o];return a?a.get(t+O,e,n,i):i},or.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=X(i));var u=(e===0?n:n>>>e)&D,f=o===m,c=this.nodes,h=c[u];if(f&&!h)return this;var p=we(h,t,e+O,n,i,o,a,s);if(p===h)return this;var _=this.count;if(!h)_++;else if(!p&&(_--,_<lu))return fu(t,c,_,u);var d=t&&t===this.ownerID,v=ho(c,u,p,d);return d?(this.count=_,this.nodes=v,this):new or(t,_,v)};var Ht=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n};Ht.prototype.get=function(t,e,n,i){for(var o=this.entries,a=0,s=o.length;a<s;a++)if(V(n,o[a][0]))return o[a][1];return i},Ht.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=X(i));var u=o===m;if(n!==this.keyHash)return u?this:(et(s),et(a),be(this,t,e,n,[i,o]));for(var f=this.entries,c=0,h=f.length;c<h&&!V(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===o:u)return this;if(et(s),(u||!p)&&et(a),u&&h===2)return new lt(t,this.keyHash,f[c^1]);var _=t&&t===this.ownerID,d=_?f:ht(f);return p?u?c===h-1?d.pop():d[c]=d.pop():d[c]=[i,o]:d.push([i,o]),_?(this.entries=d,this):new Ht(t,this.keyHash,d)};var lt=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n};lt.prototype.get=function(t,e,n,i){return V(n,this.entry[0])?this.entry[1]:i},lt.prototype.update=function(t,e,n,i,o,a,s){var u=o===m,f=V(i,this.entry[0]);if(f?o===this.entry[1]:u)return this;if(et(s),u){et(a);return}return f?t&&t===this.ownerID?(this.entry[1]=o,this):new lt(t,this.keyHash,[i,o]):(et(a),be(this,t,e,X(i),[i,o]))},ir.prototype.iterate=Ht.prototype.iterate=function(r,t){for(var e=this.entries,n=0,i=e.length-1;n<=i;n++)if(r(e[t?i-n:n])===!1)return!1},Ut.prototype.iterate=or.prototype.iterate=function(r,t){for(var e=this.nodes,n=0,i=e.length-1;n<=i;n++){var o=e[t?i-n:n];if(o&&o.iterate(r,t)===!1)return!1}},lt.prototype.iterate=function(r,t){return r(this.entry)};var su=(function(r){function t(e,n,i){this._type=n,this._reverse=i,this._stack=e._root&&ao(e._root)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.next=function(){for(var n=this._type,i=this._stack;i;){var o=i.node,a=i.index++,s=void 0;if(o.entry){if(a===0)return me(n,o.entry)}else if(o.entries){if(s=o.entries.length-1,a<=s)return me(n,o.entries[this._reverse?s-a:a])}else if(s=o.nodes.length-1,a<=s){var u=o.nodes[this._reverse?s-a:a];if(u){if(u.entry)return me(n,u.entry);i=this._stack=ao(u,i)}continue}i=this._stack=this._stack.__prev}return N()},t})(S);function me(r,t){return C(r,t[0],t[1])}function ao(r,t){return{node:r,index:0,__prev:t}}function Se(r,t,e,n){var i=Object.create(R);return i.size=r,i._root=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var so;function pt(){return so||(so=Se(0))}function uo(r,t,e){var n,i;if(r._root){var o=Gr(),a=Gr();if(n=we(r._root,r.__ownerID,0,void 0,t,e,o,a),!a.value)return r;i=r.size+(o.value?e===m?-1:1:0)}else{if(e===m)return r;i=1,n=new ir(r.__ownerID,[[t,e]])}return r.__ownerID?(r.size=i,r._root=n,r.__hash=void 0,r.__altered=!0,r):n?Se(i,n):pt()}function we(r,t,e,n,i,o,a,s){return r?r.update(t,e,n,i,o,a,s):o===m?r:(et(s),et(a),new lt(t,n,[i,o]))}function fo(r){return r.constructor===lt||r.constructor===Ht}function be(r,t,e,n,i){if(r.keyHash===n)return new Ht(t,n,[r.entry,i]);var o=(e===0?r.keyHash:r.keyHash>>>e)&D,a=(e===0?n:n>>>e)&D,s,u=o===a?[be(r,t,e+O,n,i)]:(s=new lt(t,n,i),o<a?[r,s]:[s,r]);return new Ut(t,1<<o|1<<a,u)}function uu(r,t,e,n){r||(r=new Yr);for(var i=new lt(r,X(e),[e,n]),o=0;o<t.length;o++){var a=t[o];i=i.update(r,0,void 0,a[0],a[1])}return i}function fu(r,t,e,n){for(var i=0,o=0,a=new Array(e),s=0,u=1,f=t.length;s<f;s++,u<<=1){var c=t[s];c!==void 0&&s!==n&&(i|=u,a[o++]=c)}return new Ut(r,i,a)}function cu(r,t,e,n,i){for(var o=0,a=new Array(J),s=0;e!==0;s++,e>>>=1)a[s]=e&1?t[o++]:void 0;return a[n]=i,new or(r,o+1,a)}function co(r){return r-=r>>1&1431655765,r=(r&858993459)+(r>>2&858993459),r=r+(r>>4)&252645135,r+=r>>8,r+=r>>16,r&127}function ho(r,t,e,n){var i=n?r:ht(r);return i[t]=e,i}function hu(r,t,e,n){var i=r.length+1;if(n&&t+1===i)return r[t]=e,r;for(var o=new Array(i),a=0,s=0;s<i;s++)s===t?(o[s]=e,a=-1):o[s]=r[s+a];return o}function pu(r,t,e){var n=r.length-1;if(e&&t===n)return r.pop(),r;for(var i=new Array(n),o=0,a=0;a<n;a++)a===t&&(o=1),i[a]=r[a+o];return i}var _u=J/4,du=J/2,lu=J/4;function po(r){if($i(r)&&typeof r!="string")return r;if(ft(r))return r.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+r)}function ar(r){try{return typeof r=="string"?JSON.stringify(r):String(r)}catch{return JSON.stringify(r)}}function vu(r,t){return ut(r)?r.has(t):bt(r)&&Pt.call(r,t)}function _o(r,t,e){return ut(r)?r.get(t,e):vu(r,t)?typeof r.get=="function"?r.get(t):r[t]:e}function yu(r,t){if(!bt(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(ut(r)){if(!r.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+r);return r.remove(t)}if(!Pt.call(r,t))return r;var e=Tr(r);return Array.isArray(e)?e.splice(t,1):delete e[t],e}function gu(r,t,e){if(!bt(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(ut(r)){if(!r.set)throw new TypeError("Cannot update immutable value without .set() method: "+r);return r.set(t,e)}if(Pt.call(r,t)&&e===r[t])return r;var n=Tr(r);return n[t]=e,n}function Kt(r,t,e,n){n||(n=e,e=void 0);var i=lo(ut(r),r,po(t),0,e,n);return i===m?e:i}function lo(r,t,e,n,i,o){var a=t===m;if(n===e.length){var s=a?i:t,u=o(s);return u===s?t:u}if(!a&&!bt(t))throw new TypeError("Cannot update within non-data-structure value in path ["+Array.from(e).slice(0,n).map(ar)+"]: "+t);var f=e[n],c=a?m:_o(t,f,m),h=lo(c===m?r:ut(c),c,e,n+1,i,o);return h===c?t:h===m?yu(t,f):gu(a?r?pt():{}:t,f,h)}function mu(r,t){return Kt(r,t,function(){return m})}function Ie(r){return mu(this,r)}var vo="@@__IMMUTABLE_LIST__@@";function yo(r){return!!(r&&r[vo])}var Rr=(function(r){function t(e){var n=zr();if(e==null)return n;if(yo(e))return e;var i=r(e),o=i.size;return o===0?n:(Z(o),o>0&&o<J?ur(0,o,O,null,new It(i.toArray())):n.withMutations(function(a){a.setSize(o),i.forEach(function(s,u){return a.set(u,s)})}))}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("List [","]")},t.prototype.get=function(n,i){if(n=mt(this,n),n>=0&&n<this.size){n+=this._origin;var o=mo(this,n);return o&&o.array[n&D]}return i},t.prototype.set=function(n,i){return Su(this,n,i)},t.prototype.remove=function(n){return this.has(n)?n===0?this.shift():n===this.size-1?this.pop():this.splice(n,1):this},t.prototype.insert=function(n,i){return this.splice(n,0,i)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=O,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):zr()},t.prototype.push=function(){var n=arguments,i=this.size;return this.withMutations(function(o){qt(o,0,i+n.length);for(var a=0;a<n.length;a++)o.set(i+a,n[a])})},t.prototype.pop=function(){return qt(this,0,-1)},t.prototype.unshift=function(){var n=arguments;return this.withMutations(function(i){qt(i,-n.length);for(var o=0;o<n.length;o++)i.set(o,n[o])})},t.prototype.shift=function(){return qt(this,1)},t.prototype.shuffle=function(n){return n===void 0&&(n=Math.random),this.withMutations(function(i){for(var o=i.size,a,s;o;)a=Math.floor(n()*o--),s=i.get(a),i.set(a,i.get(o)),i.set(o,s)})},t.prototype.concat=function(){for(var n=arguments,i=[],o=0;o<arguments.length;o++){var a=n[o],s=r(typeof a!="string"&&Oi(a)?a:[a]);s.size!==0&&i.push(s)}return i.length===0?this:this.size===0&&!this.__ownerID&&i.length===1?this.constructor(i[0]):this.withMutations(function(u){i.forEach(function(f){return f.forEach(function(c){return u.push(c)})})})},t.prototype.setSize=function(n){return qt(this,0,n)},t.prototype.map=function(n,i){var o=this;return this.withMutations(function(a){for(var s=0;s<o.size;s++)a.set(s,n.call(i,a.get(s),s,o))})},t.prototype.slice=function(n,i){var o=this.size;return br(n,i,o)?this:qt(this,Zt(n,o),Ir(i,o))},t.prototype.__iterator=function(n,i){var o=i?this.size:0,a=go(this,i);return new S(function(){var s=a();return s===sr?N():C(n,i?--o:o++,s)})},t.prototype.__iterate=function(n,i){for(var o=i?this.size:0,a=go(this,i),s;(s=a())!==sr&&n(s,i?--o:o++,this)!==!1;);return o},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?ur(this._origin,this._capacity,this._level,this._root,this._tail,n,this.__hash):this.size===0?zr():(this.__ownerID=n,this.__altered=!1,this)},t})(Rt);Rr.isList=yo;var j=Rr.prototype;j[vo]=!0,j[Vt]=j.remove,j.merge=j.concat,j.setIn=de,j.deleteIn=j.removeIn=Ie,j.update=le,j.updateIn=ve,j.mergeIn=_e,j.mergeDeepIn=pe,j.withMutations=er,j.wasAltered=ye,j.asImmutable=Qt,j["@@transducer/init"]=j.asMutable=tr,j["@@transducer/step"]=function(r,t){return r.push(t)},j["@@transducer/result"]=function(r){return r.asImmutable()};var It=function(t,e){this.array=t,this.ownerID=e};It.prototype.removeBefore=function(t,e,n){if((n&(1<<e+O)-1)===0||this.array.length===0)return this;var i=n>>>e&D;if(i>=this.array.length)return new It([],t);var o=i===0,a;if(e>0){var s=this.array[i];if(a=s&&s.removeBefore(t,e-O,n),a===s&&o)return this}if(o&&!a)return this;var u=Wt(this,t);if(!o)for(var f=0;f<i;f++)u.array[f]=void 0;return a&&(u.array[i]=a),u},It.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e+O:J)||this.array.length===0)return this;var i=n-1>>>e&D;if(i>=this.array.length)return this;var o;if(e>0){var a=this.array[i];if(o=a&&a.removeAfter(t,e-O,n),o===a&&i===this.array.length-1)return this}var s=Wt(this,t);return s.array.splice(i+1),o&&(s.array[i]=o),s};var sr={};function go(r,t){var e=r._origin,n=r._capacity,i=fr(n),o=r._tail;return a(r._root,r._level,0);function a(f,c,h){return c===0?s(f,h):u(f,c,h)}function s(f,c){var h=c===i?o&&o.array:f&&f.array,p=c>e?0:e-c,_=n-c;return _>J&&(_=J),function(){if(p===_)return sr;var d=t?--_:p++;return h&&h[d]}}function u(f,c,h){var p,_=f&&f.array,d=h>e?0:e-h>>c,v=(n-h>>c)+1;return v>J&&(v=J),function(){for(;;){if(p){var w=p();if(w!==sr)return w;p=null}if(d===v)return sr;var I=t?--v:d++;p=a(_&&_[I],c-O,h+(I<<c))}}}}function ur(r,t,e,n,i,o,a){var s=Object.create(j);return s.size=t-r,s._origin=r,s._capacity=t,s._level=e,s._root=n,s._tail=i,s.__ownerID=o,s.__hash=a,s.__altered=!1,s}function zr(){return ur(0,0,O)}function Su(r,t,e){if(t=mt(r,t),t!==t)return r;if(t>=r.size||t<0)return r.withMutations(function(a){t<0?qt(a,t).set(0,e):qt(a,0,t+1).set(t,e)});t+=r._origin;var n=r._tail,i=r._root,o=Gr();return t>=fr(r._capacity)?n=qe(n,r.__ownerID,0,t,e,o):i=qe(i,r.__ownerID,r._level,t,e,o),o.value?r.__ownerID?(r._root=i,r._tail=n,r.__hash=void 0,r.__altered=!0,r):ur(r._origin,r._capacity,r._level,i,n):r}function qe(r,t,e,n,i,o){var a=n>>>e&D,s=r&&a<r.array.length;if(!s&&i===void 0)return r;var u;if(e>0){var f=r&&r.array[a],c=qe(f,t,e-O,n,i,o);return c===f?r:(u=Wt(r,t),u.array[a]=c,u)}return s&&r.array[a]===i?r:(o&&et(o),u=Wt(r,t),i===void 0&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Wt(r,t){return t&&r&&t===r.ownerID?r:new It(r?r.array.slice():[],t)}function mo(r,t){if(t>=fr(r._capacity))return r._tail;if(t<1<<r._level+O){for(var e=r._root,n=r._level;e&&n>0;)e=e.array[t>>>n&D],n-=O;return e}}function qt(r,t,e){t!==void 0&&(t|=0),e!==void 0&&(e|=0);var n=r.__ownerID||new Yr,i=r._origin,o=r._capacity,a=i+t,s=e===void 0?o:e<0?o+e:i+e;if(a===i&&s===o)return r;if(a>=s)return r.clear();for(var u=r._level,f=r._root,c=0;a+c<0;)f=new It(f&&f.array.length?[void 0,f]:[],n),u+=O,c+=1<<u;c&&(a+=c,i+=c,s+=c,o+=c);for(var h=fr(o),p=fr(s);p>=1<<u+O;)f=new It(f&&f.array.length?[f]:[],n),u+=O;var _=r._tail,d=p<h?mo(r,s-1):p>h?new It([],n):_;if(_&&p>h&&a<o&&_.array.length){f=Wt(f,n);for(var v=f,w=u;w>O;w-=O){var I=h>>>w&D;v=v.array[I]=Wt(v.array[I],n)}v.array[h>>>O&D]=_}if(s<o&&(d=d&&d.removeAfter(n,0,s)),a>=p)a-=p,s-=p,u=O,f=null,d=d&&d.removeBefore(n,0,a);else if(a>i||p<h){for(c=0;f;){var y=a>>>u&D;if(y!==p>>>u&D)break;y&&(c+=(1<<u)*y),u-=O,f=f.array[y]}f&&a>i&&(f=f.removeBefore(n,u,a-c)),f&&p<h&&(f=f.removeAfter(n,u,p-c)),c&&(a-=c,s-=c)}return r.__ownerID?(r.size=s-a,r._origin=a,r._capacity=s,r._level=u,r._root=f,r._tail=d,r.__hash=void 0,r.__altered=!0,r):ur(a,s,u,f,d)}function fr(r){return r<J?0:r-1>>>O<<O}function So(r){return ge(r)&&ft(r)}var vt=(function(r){function t(e){return e==null?cr():So(e)?e:cr().withMutations(function(n){var i=rt(e);Z(i.size),i.forEach(function(o,a){return n.set(a,o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(n,i){var o=this._map.get(n);return o!==void 0?this._list.get(o)[1]:i},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):cr()},t.prototype.set=function(n,i){return bo(this,n,i)},t.prototype.remove=function(n){return bo(this,n,m)},t.prototype.__iterate=function(n,i){var o=this;return this._list.__iterate(function(a){return a&&n(a[1],a[0],o)},i)},t.prototype.__iterator=function(n,i){return this._list.fromEntrySeq().__iterator(n,i)},t.prototype.__ensureOwner=function(n){if(n===this.__ownerID)return this;var i=this._map.__ensureOwner(n),o=this._list.__ensureOwner(n);return n?Me(i,o,n,this.__hash):this.size===0?cr():(this.__ownerID=n,this.__altered=!1,this._map=i,this._list=o,this)},t})(B);vt.isOrderedMap=So,vt.prototype[St]=!0,vt.prototype[Vt]=vt.prototype.remove;function Me(r,t,e,n){var i=Object.create(vt.prototype);return i.size=r?r.size:0,i._map=r,i._list=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var wo;function cr(){return wo||(wo=Me(pt(),zr()))}function bo(r,t,e){var n=r._map,i=r._list,o=n.get(t),a=o!==void 0,s,u;if(e===m){if(!a)return r;i.size>=J&&i.size>=n.size*2?(u=i.filter(function(f,c){return f!==void 0&&o!==c}),s=u.toKeyedSeq().map(function(f){return f[0]}).flip().toMap(),r.__ownerID&&(s.__ownerID=u.__ownerID=r.__ownerID)):(s=n.remove(t),u=o===i.size-1?i.pop():i.set(o,void 0))}else if(a){if(e===i.get(o)[1])return r;s=n,u=i.set(o,[t,e])}else s=n.set(t,i.size),u=i.set(i.size,[t,e]);return r.__ownerID?(r.size=s.size,r._map=s,r._list=u,r.__hash=void 0,r.__altered=!0,r):Me(s,u)}var Io="@@__IMMUTABLE_STACK__@@";function Oe(r){return!!(r&&r[Io])}var Ee=(function(r){function t(e){return e==null?Cr():Oe(e)?e:Cr().pushAll(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(n,i){var o=this._head;for(n=mt(this,n);o&&n--;)o=o.next;return o?o.value:i},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var n=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,o=this._head,a=arguments.length-1;a>=0;a--)o={value:n[a],next:o};return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):hr(i,o)},t.prototype.pushAll=function(n){if(n=r(n),n.size===0)return this;if(this.size===0&&Oe(n))return n;Z(n.size);var i=this.size,o=this._head;return n.__iterate(function(a){i++,o={value:a,next:o}},!0),this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):hr(i,o)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Cr()},t.prototype.slice=function(n,i){if(br(n,i,this.size))return this;var o=Zt(n,this.size),a=Ir(i,this.size);if(a!==this.size)return r.prototype.slice.call(this,n,i);for(var s=this.size-o,u=this._head;o--;)u=u.next;return this.__ownerID?(this.size=s,this._head=u,this.__hash=void 0,this.__altered=!0,this):hr(s,u)},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?hr(this.size,this._head,n,this.__hash):this.size===0?Cr():(this.__ownerID=n,this.__altered=!1,this)},t.prototype.__iterate=function(n,i){var o=this;if(i)return new Dt(this.toArray()).__iterate(function(u,f){return n(u,f,o)},i);for(var a=0,s=this._head;s&&n(s.value,a++,this)!==!1;)s=s.next;return a},t.prototype.__iterator=function(n,i){if(i)return new Dt(this.toArray()).__iterator(n,i);var o=0,a=this._head;return new S(function(){if(a){var s=a.value;return a=a.next,C(n,o++,s)}return N()})},t})(Rt);Ee.isStack=Oe;var F=Ee.prototype;F[Io]=!0,F.shift=F.pop,F.unshift=F.push,F.unshiftAll=F.pushAll,F.withMutations=er,F.wasAltered=ye,F.asImmutable=Qt,F["@@transducer/init"]=F.asMutable=tr,F["@@transducer/step"]=function(r,t){return r.unshift(t)},F["@@transducer/result"]=function(r){return r.asImmutable()};function hr(r,t,e,n){var i=Object.create(F);return i.size=r,i._head=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var qo;function Cr(){return qo||(qo=hr(0))}function Mo(r,t,e,n,i,o){return Z(r.size),r.__iterate(function(a,s,u){i?(i=!1,e=a):e=t.call(n,e,a,s,u)},o),e}function wu(r,t){return t}function bu(r,t){return[t,r]}function Te(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return!r.apply(this,t)}}function Oo(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return-r.apply(this,t)}}function Eo(r,t){return r<t?1:r>t?-1:0}function To(r,t){if(r===t)return!0;if(!W(t)||r.size!==void 0&&t.size!==void 0&&r.size!==t.size||r.__hash!==void 0&&t.__hash!==void 0&&r.__hash!==t.__hash||z(r)!==z(t)||tt(r)!==tt(t)||ft(r)!==ft(t))return!1;if(r.size===0&&t.size===0)return!0;var e=!Hr(r);if(ft(r)){var n=r.entries();return t.every(function(u,f){var c=n.next().value;return c&&V(c[1],u)&&(e||V(c[0],f))})&&n.next().done}var i=!1;if(r.size===void 0)if(t.size===void 0)typeof r.cacheResult=="function"&&r.cacheResult();else{i=!0;var o=r;r=t,t=o}var a=!0,s=t.__iterate(function(u,f){if(e?!r.has(u):i?!V(u,r.get(f,m)):!V(r.get(f,m),u))return a=!1,!1});return a&&r.size===s}var Iu=(function(r){function t(e,n,i){if(i===void 0&&(i=1),!(this instanceof t))return new t(e,n,i);if(nr(i!==0,"Cannot step a Range by 0"),nr(e!==void 0,"You must define a start value when using Range"),nr(n!==void 0,"You must define an end value when using Range"),i=Math.abs(i),n<e&&(i=-i),this._start=e,this._end=n,this._step=i,this.size=Math.max(0,Math.ceil((n-e)/i-1)+1),this.size===0){if(Re)return Re;Re=this}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},t.prototype.get=function(n,i){return this.has(n)?this._start+mt(this,n)*this._step:i},t.prototype.includes=function(n){var i=(n-this._start)/this._step;return i>=0&&i<this.size&&i===Math.floor(i)},t.prototype.slice=function(n,i){return br(n,i,this.size)?this:(n=Zt(n,this.size),i=Ir(i,this.size),i<=n?new t(0,0):new t(this.get(n,this._end),this.get(i,this._end),this._step))},t.prototype.indexOf=function(n){var i=n-this._start;if(i%this._step===0){var o=i/this._step;if(o>=0&&o<this.size)return o}return-1},t.prototype.lastIndexOf=function(n){return this.indexOf(n)},t.prototype.__iterate=function(n,i){for(var o=this.size,a=this._step,s=i?this._start+(o-1)*a:this._start,u=0;u!==o&&n(s,i?o-++u:u++,this)!==!1;)s+=i?-a:a;return u},t.prototype.__iterator=function(n,i){var o=this.size,a=this._step,s=i?this._start+(o-1)*a:this._start,u=0;return new S(function(){if(u===o)return N();var f=s;return s+=i?-a:a,C(n,i?o-++u:u++,f)})},t.prototype.equals=function(n){return n instanceof t?this._start===n._start&&this._end===n._end&&this._step===n._step:To(this,n)},t})(it),Re,Ro="@@__IMMUTABLE_SET__@@";function ze(r){return!!(r&&r[Ro])}var _t=(function(r){function t(e){return e==null?pr():ze(e)&&!ft(e)?e:pr().withMutations(function(n){var i=r(e);Z(i.size),i.forEach(function(o){return n.add(o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(n){return this(rt(n).keySeq())},t.intersect=function(n){return n=L(n).toArray(),n.length?x.intersect.apply(t(n.pop()),n):pr()},t.union=function(n){return n=L(n).toArray(),n.length?x.union.apply(t(n.pop()),n):pr()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(n){return this._map.has(n)},t.prototype.add=function(n){return Ar(this,this._map.set(n,n))},t.prototype.remove=function(n){return Ar(this,this._map.remove(n))},t.prototype.clear=function(){return Ar(this,this._map.clear())},t.prototype.map=function(n,i){var o=this,a=!1,s=Ar(this,this._map.mapEntries(function(u){var f=u[1],c=n.call(i,f,f,o);return c!==f&&(a=!0),[c,c]},i));return a?s:this},t.prototype.union=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return n=n.filter(function(o){return o.size!==0}),n.length===0?this:this.size===0&&!this.__ownerID&&n.length===1?this.constructor(n[0]):this.withMutations(function(o){for(var a=0;a<n.length;a++)typeof n[a]=="string"?o.add(n[a]):r(n[a]).forEach(function(s){return o.add(s)})})},t.prototype.intersect=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(n.length===0)return this;n=n.map(function(a){return r(a)});var o=[];return this.forEach(function(a){n.every(function(s){return s.includes(a)})||o.push(a)}),this.withMutations(function(a){o.forEach(function(s){a.remove(s)})})},t.prototype.subtract=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(n.length===0)return this;n=n.map(function(a){return r(a)});var o=[];return this.forEach(function(a){n.some(function(s){return s.includes(a)})&&o.push(a)}),this.withMutations(function(a){o.forEach(function(s){a.remove(s)})})},t.prototype.sort=function(n){return dr(Ft(this,n))},t.prototype.sortBy=function(n,i){return dr(Ft(this,i,n))},t.prototype.wasAltered=function(){return this._map.wasAltered()},t.prototype.__iterate=function(n,i){var o=this;return this._map.__iterate(function(a){return n(a,a,o)},i)},t.prototype.__iterator=function(n,i){return this._map.__iterator(n,i)},t.prototype.__ensureOwner=function(n){if(n===this.__ownerID)return this;var i=this._map.__ensureOwner(n);return n?this.__make(i,n):this.size===0?this.__empty():(this.__ownerID=n,this._map=i,this)},t})(jt);_t.isSet=ze;var x=_t.prototype;x[Ro]=!0,x[Vt]=x.remove,x.merge=x.concat=x.union,x.withMutations=er,x.asImmutable=Qt,x["@@transducer/init"]=x.asMutable=tr,x["@@transducer/step"]=function(r,t){return r.add(t)},x["@@transducer/result"]=function(r){return r.asImmutable()},x.__empty=pr,x.__make=zo;function Ar(r,t){return r.__ownerID?(r.size=t.size,r._map=t,r):t===r._map?r:t.size===0?r.__empty():r.__make(t)}function zo(r,t){var e=Object.create(x);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var Co;function pr(){return Co||(Co=zo(pt()))}function Ao(r,t,e){for(var n=po(t),i=0;i!==n.length;)if(r=_o(r,n[i++],m),r===m)return e;return r}function $o(r,t){return Ao(this,r,t)}function qu(r,t){return Ao(r,t,m)!==m}function Mu(r){return qu(this,r)}function ko(){Z(this.size);var r={};return this.__iterate(function(t,e){r[e]=t}),r}function $r(r){if(!r||typeof r!="object")return r;if(!W(r)){if(!bt(r))return r;r=H(r)}if(z(r)){var t={};return r.__iterate(function(n,i){t[i]=$r(n)}),t}var e=[];return r.__iterate(function(n){e.push($r(n))}),e}function Ou(r){if(r.size===1/0)return 0;var t=ft(r),e=z(r),n=t?1:0;return r.__iterate(e?t?function(i,o){n=31*n+Bo(X(i),X(o))|0}:function(i,o){n=n+Bo(X(i),X(o))|0}:t?function(i){n=31*n+X(i)|0}:function(i){n=n+X(i)|0}),Eu(r.size,n)}function Eu(r,t){return t=rr(t,3432918353),t=rr(t<<15|t>>>-15,461845907),t=rr(t<<13|t>>>-13,5),t=(t+3864292196|0)^r,t=rr(t^t>>>16,2246822507),t=rr(t^t>>>13,3266489909),t=qr(t^t>>>16),t}function Bo(r,t){return r^t+2654435769+(r<<6)+(r>>2)|0}function At(r,t){var e=function(n){r.prototype[n]=t[n]};return Object.keys(t).forEach(e),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(e),r}L.Iterator=S,At(L,{toArray:function(){Z(this.size);var t=new Array(this.size||0),e=z(this),n=0;return this.__iterate(function(i,o){t[n++]=e?[o,i]:i}),t},toIndexedSeq:function(){return new Di(this)},toJS:function(){return $r(this)},toKeyedSeq:function(){return new Mr(this,!0)},toMap:function(){return B(this.toKeyedSeq())},toObject:ko,toOrderedMap:function(){return vt(this.toKeyedSeq())},toOrderedSet:function(){return dr(z(this)?this.valueSeq():this)},toSet:function(){return _t(z(this)?this.valueSeq():this)},toSetSeq:function(){return new Fi(this)},toSeq:function(){return tt(this)?this.toIndexedSeq():z(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Ee(z(this)?this.valueSeq():this)},toList:function(){return Rr(z(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(t,e){return this.size===0?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return E(this,Qs(this,t))},includes:function(t){return this.some(function(e){return V(e,t)})},entries:function(){return this.__iterator(Y)},every:function(t,e){Z(this.size);var n=!0;return this.__iterate(function(i,o,a){if(!t.call(e,i,o,a))return n=!1,!1}),n},filter:function(t,e){return E(this,Wi(this,t,e,!0))},partition:function(t,e){return Xs(this,t,e)},find:function(t,e,n){var i=this.findEntry(t,e);return i?i[1]:n},forEach:function(t,e){return Z(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){Z(this.size),t=t!==void 0?""+t:",";var e="",n=!0;return this.__iterate(function(i){n?n=!1:e+=t,e+=i!=null?i.toString():""}),e},keys:function(){return this.__iterator(xt)},map:function(t,e){return E(this,Ki(this,t,e))},reduce:function(t,e,n){return Mo(this,t,e,n,arguments.length<2,!1)},reduceRight:function(t,e,n){return Mo(this,t,e,n,arguments.length<2,!0)},reverse:function(){return E(this,ae(this,!0))},slice:function(t,e){return E(this,se(this,t,e,!0))},some:function(t,e){Z(this.size);var n=!1;return this.__iterate(function(i,o,a){if(t.call(e,i,o,a))return n=!0,!1}),n},sort:function(t){return E(this,Ft(this,t))},values:function(){return this.__iterator(G)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(t,e){return Lt(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return Ys(this,t,e)},equals:function(t){return To(this,t)},entrySeq:function(){var t=this;if(t._cache)return new Dt(t._cache);var e=t.toSeq().map(bu).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Te(t),e)},findEntry:function(t,e,n){var i=n;return this.__iterate(function(o,a,s){if(t.call(e,o,a,s))return i=[a,o],!1}),i},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastEntry:function(t,e,n){return this.toKeyedSeq().reverse().findEntry(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(t){return this.find(Ti,null,t)},flatMap:function(t,e){return E(this,tu(this,t,e))},flatten:function(t){return E(this,Yi(this,t,!0))},fromEntrySeq:function(){return new Ui(this)},get:function(t,e){return this.find(function(n,i){return V(i,t)},void 0,e)},getIn:$o,groupBy:function(t,e){return Js(this,t,e)},has:function(t){return this.get(t,m)!==m},hasIn:Mu,isSubset:function(t){return t=typeof t.includes=="function"?t:L(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t=typeof t.isSubset=="function"?t:L(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return V(e,t)})},keySeq:function(){return this.toSeq().map(wu).toIndexedSeq()},last:function(t){return this.toSeq().reverse().first(t)},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return Or(this,t)},maxBy:function(t,e){return Or(this,e,t)},min:function(t){return Or(this,t?Oo(t):Eo)},minBy:function(t,e){return Or(this,e?Oo(e):Eo,t)},rest:function(){return this.slice(1)},skip:function(t){return t===0?this:this.slice(Math.max(0,t))},skipLast:function(t){return t===0?this:this.slice(0,-Math.max(0,t))},skipWhile:function(t,e){return E(this,Gi(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Te(t),e)},sortBy:function(t,e){return E(this,Ft(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return this.slice(-Math.max(0,t))},takeWhile:function(t,e){return E(this,Vs(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Te(t),e)},update:function(t){return t(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=Ou(this))}});var P=L.prototype;P[qi]=!0,P[Sr]=P.values,P.toJSON=P.toArray,P.__toStringMapper=ar,P.inspect=P.toSource=function(){return this.toString()},P.chain=P.flatMap,P.contains=P.includes,At(rt,{flip:function(){return E(this,Hi(this))},mapEntries:function(t,e){var n=this,i=0;return E(this,this.toSeq().map(function(o,a){return t.call(e,[a,o],i++,n)}).fromEntrySeq())},mapKeys:function(t,e){var n=this;return E(this,this.toSeq().flip().map(function(i,o){return t.call(e,i,o,n)}).flip())}});var _r=rt.prototype;_r[mr]=!0,_r[Sr]=P.entries,_r.toJSON=ko,_r.__toStringMapper=function(r,t){return ar(t)+": "+ar(r)},At(Rt,{toKeyedSeq:function(){return new Mr(this,!1)},filter:function(t,e){return E(this,Wi(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.keyOf(t);return e===void 0?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return e===void 0?-1:e},reverse:function(){return E(this,ae(this,!1))},slice:function(t,e){return E(this,se(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(e||0,0),n===0||n===2&&!e)return this;t=Zt(t,t<0?this.count():this.size);var i=this.slice(0,t);return E(this,n===1?i:i.concat(ht(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.findLastEntry(t,e);return n?n[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return E(this,Yi(this,t,!1))},get:function(t,e){return t=mt(this,t),t<0||this.size===1/0||this.size!==void 0&&t>this.size?e:this.find(function(n,i){return i===t},void 0,e)},has:function(t){return t=mt(this,t),t>=0&&(this.size!==void 0?this.size===1/0||t<this.size:this.indexOf(t)!==-1)},interpose:function(t){return E(this,ru(this,t))},interleave:function(){var t=[this].concat(ht(arguments)),e=Er(this.toSeq(),it.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),E(this,n)},keySeq:function(){return Iu(0,this.size)},last:function(t){return this.get(-1,t)},skipWhile:function(t,e){return E(this,Gi(this,t,e,!1))},zip:function(){var t=[this].concat(ht(arguments));return E(this,Er(this,jo,t))},zipAll:function(){var t=[this].concat(ht(arguments));return E(this,Er(this,jo,t,!0))},zipWith:function(t){var e=ht(arguments);return e[0]=this,E(this,Er(this,t,e))}});var Gt=Rt.prototype;Gt[gt]=!0,Gt[St]=!0,At(jt,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}});var Yt=jt.prototype;Yt.has=P.includes,Yt.contains=Yt.includes,Yt.keys=Yt.values,At(wt,_r),At(it,Gt),At(Nt,Yt);function jo(){return ht(arguments)}function xo(r){return ze(r)&&ft(r)}var dr=(function(r){function t(e){return e==null?Ce():xo(e)?e:Ce().withMutations(function(n){var i=jt(e);Z(i.size),i.forEach(function(o){return n.add(o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(n){return this(rt(n).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t})(_t);dr.isOrderedSet=xo;var $t=dr.prototype;$t[St]=!0,$t.zip=Gt.zip,$t.zipWith=Gt.zipWith,$t.zipAll=Gt.zipAll,$t.__empty=Ce,$t.__make=Lo;function Lo(r,t){var e=Object.create($t);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var Po;function Ce(){return Po||(Po=Lo(cr()))}function Tu(r){if(zt(r))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(ut(r))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(r===null||typeof r!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var $=function(t,e){var n;Tu(t);var i=function(s){var u=this;if(s instanceof i)return s;if(!(this instanceof i))return new i(s);if(!n){n=!0;var f=Object.keys(t),c=o._indices={};o._name=e,o._keys=f,o._defaultValues=t;for(var h=0;h<f.length;h++){var p=f[h];c[p]=h,o[p]?typeof console=="object"&&console.warn&&console.warn("Cannot define "+$e(this)+' with property "'+p+'" since that property name is part of the Record API.'):Ru(o,p)}}return this.__ownerID=void 0,this._values=Rr().withMutations(function(_){_.setSize(u._keys.length),rt(s).forEach(function(d,v){_.set(u._indices[v],d===u._defaultValues[v]?void 0:d)})}),this},o=i.prototype=Object.create(T);return o.constructor=i,e&&(i.displayName=e),i};$.prototype.toString=function(){for(var t=$e(this)+" { ",e=this._keys,n,i=0,o=e.length;i!==o;i++)n=e[i],t+=(i?", ":"")+n+": "+ar(this.get(n));return t+" }"},$.prototype.equals=function(t){return this===t||zt(t)&&Jt(this).equals(Jt(t))},$.prototype.hashCode=function(){return Jt(this).hashCode()},$.prototype.has=function(t){return this._indices.hasOwnProperty(t)},$.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._indices[t],i=this._values.get(n);return i===void 0?this._defaultValues[t]:i},$.prototype.set=function(t,e){if(this.has(t)){var n=this._values.set(this._indices[t],e===this._defaultValues[t]?void 0:e);if(n!==this._values&&!this.__ownerID)return Ae(this,n)}return this},$.prototype.remove=function(t){return this.set(t)},$.prototype.clear=function(){var t=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Ae(this,t)},$.prototype.wasAltered=function(){return this._values.wasAltered()},$.prototype.toSeq=function(){return Jt(this)},$.prototype.toJS=function(){return $r(this)},$.prototype.entries=function(){return this.__iterator(Y)},$.prototype.__iterator=function(t,e){return Jt(this).__iterator(t,e)},$.prototype.__iterate=function(t,e){return Jt(this).__iterate(t,e)},$.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._values.__ensureOwner(t);return t?Ae(this,e,t):(this.__ownerID=t,this._values=e,this)},$.isRecord=zt,$.getDescriptiveName=$e;var T=$.prototype;T[Ci]=!0,T[Vt]=T.remove,T.deleteIn=T.removeIn=Ie,T.getIn=$o,T.hasIn=P.hasIn,T.merge=to,T.mergeWith=ro,T.mergeIn=_e,T.mergeDeep=no,T.mergeDeepWith=io,T.mergeDeepIn=pe,T.setIn=de,T.update=le,T.updateIn=ve,T.withMutations=er,T.asMutable=tr,T.asImmutable=Qt,T[Sr]=T.entries,T.toJSON=T.toObject=P.toObject,T.inspect=T.toSource=function(){return this.toString()};function Ae(r,t,e){var n=Object.create(Object.getPrototypeOf(r));return n._values=t,n.__ownerID=e,n}function $e(r){return r.constructor.displayName||r.constructor.name||"Record"}function Jt(r){return Zr(r._keys.map(function(t){return[t,r.get(t)]}))}function Ru(r,t){try{Object.defineProperty(r,t,{get:function(){return this.get(t)},set:function(e){nr(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch{}}var kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ke,No;function Do(){if(No)return ke;No=1;function r(t,e){for(var n=-1,i=e.length,o=t.length;++n<i;)t[o+n]=e[n];return t}return ke=r,ke}var Be,Fo;function Cu(){if(Fo)return Be;Fo=1;var r=typeof kr=="object"&&kr&&kr.Object===Object&&kr;return Be=r,Be}var je,Uo;function xe(){if(Uo)return je;Uo=1;var r=Cu(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return je=e,je}var Le,Ho;function Br(){if(Ho)return Le;Ho=1;var r=xe(),t=r.Symbol;return Le=t,Le}var Pe,Ko;function Au(){if(Ko)return Pe;Ko=1;var r=Br(),t=Object.prototype,e=t.hasOwnProperty,n=t.toString,i=r?r.toStringTag:void 0;function o(a){var s=e.call(a,i),u=a[i];try{a[i]=void 0;var f=!0}catch{}var c=n.call(a);return f&&(s?a[i]=u:delete a[i]),c}return Pe=o,Pe}var Ne,Wo;function $u(){if(Wo)return Ne;Wo=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return Ne=e,Ne}var De,Go;function jr(){if(Go)return De;Go=1;var r=Br(),t=Au(),e=$u(),n="[object Null]",i="[object Undefined]",o=r?r.toStringTag:void 0;function a(s){return s==null?s===void 0?i:n:o&&o in Object(s)?t(s):e(s)}return De=a,De}var Fe,Yo;function xr(){if(Yo)return Fe;Yo=1;function r(t){return t!=null&&typeof t=="object"}return Fe=r,Fe}var Ue,Jo;function ku(){if(Jo)return Ue;Jo=1;var r=jr(),t=xr(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return Ue=n,Ue}var He,Xo;function Vo(){if(Xo)return He;Xo=1;var r=ku(),t=xr(),e=Object.prototype,n=e.hasOwnProperty,i=e.propertyIsEnumerable,o=r((function(){return arguments})())?r:function(a){return t(a)&&n.call(a,"callee")&&!i.call(a,"callee")};return He=o,He}var Ke,Zo;function Mt(){if(Zo)return Ke;Zo=1;var r=Array.isArray;return Ke=r,Ke}var We,Qo;function Bu(){if(Qo)return We;Qo=1;var r=Br(),t=Vo(),e=Mt(),n=r?r.isConcatSpreadable:void 0;function i(o){return e(o)||t(o)||!!(n&&o&&o[n])}return We=i,We}var Ge,ta;function ju(){if(ta)return Ge;ta=1;var r=Do(),t=Bu();function e(n,i,o,a,s){var u=-1,f=n.length;for(o||(o=t),s||(s=[]);++u<f;){var c=n[u];i>0&&o(c)?i>1?e(c,i-1,o,a,s):r(s,c):a||(s[s.length]=c)}return s}return Ge=e,Ge}var Ye,ra;function xu(){if(ra)return Ye;ra=1;function r(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}return Ye=r,Ye}var Je,ea;function Lu(){if(ea)return Je;ea=1;var r=Do(),t=ju(),e=xu(),n=Mt();function i(){var o=arguments.length;if(!o)return[];for(var a=Array(o-1),s=arguments[0],u=o;u--;)a[u-1]=arguments[u];return r(n(s)?e(s):[s],t(a,1))}return Je=i,Je}Lu();var Xe,na;function Pu(){if(na)return Xe;na=1;function r(t,e){return t!=null&&e in Object(t)}return Xe=r,Xe}var Ve,ia;function Lr(){if(ia)return Ve;ia=1;var r=jr(),t=xr(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return Ve=n,Ve}var Ze,oa;function Nu(){if(oa)return Ze;oa=1;var r=Mt(),t=Lr(),e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(o,a){if(r(o))return!1;var s=typeof o;return s=="number"||s=="symbol"||s=="boolean"||o==null||t(o)?!0:n.test(o)||!e.test(o)||a!=null&&o in Object(a)}return Ze=i,Ze}var Qe,aa;function tn(){if(aa)return Qe;aa=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return Qe=r,Qe}var rn,sa;function Du(){if(sa)return rn;sa=1;var r=jr(),t=tn(),e="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function a(s){if(!t(s))return!1;var u=r(s);return u==n||u==i||u==e||u==o}return rn=a,rn}var en,ua;function Fu(){if(ua)return en;ua=1;var r=xe(),t=r["__core-js_shared__"];return en=t,en}var nn,fa;function Uu(){if(fa)return nn;fa=1;var r=Fu(),t=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function e(n){return!!t&&t in n}return nn=e,nn}var on,ca;function Hu(){if(ca)return on;ca=1;var r=Function.prototype,t=r.toString;function e(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return on=e,on}var an,ha;function Ku(){if(ha)return an;ha=1;var r=Du(),t=Uu(),e=tn(),n=Hu(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,a=Function.prototype,s=Object.prototype,u=a.toString,f=s.hasOwnProperty,c=RegExp("^"+u.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(p){if(!e(p)||t(p))return!1;var _=r(p)?c:o;return _.test(n(p))}return an=h,an}var sn,pa;function Wu(){if(pa)return sn;pa=1;function r(t,e){return t?.[e]}return sn=r,sn}var un,_a;function da(){if(_a)return un;_a=1;var r=Ku(),t=Wu();function e(n,i){var o=t(n,i);return r(o)?o:void 0}return un=e,un}var fn,la;function Pr(){if(la)return fn;la=1;var r=da(),t=r(Object,"create");return fn=t,fn}var cn,va;function Gu(){if(va)return cn;va=1;var r=Pr();function t(){this.__data__=r?r(null):{},this.size=0}return cn=t,cn}var hn,ya;function Yu(){if(ya)return hn;ya=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return hn=r,hn}var pn,ga;function Ju(){if(ga)return pn;ga=1;var r=Pr(),t="__lodash_hash_undefined__",e=Object.prototype,n=e.hasOwnProperty;function i(o){var a=this.__data__;if(r){var s=a[o];return s===t?void 0:s}return n.call(a,o)?a[o]:void 0}return pn=i,pn}var _n,ma;function Xu(){if(ma)return _n;ma=1;var r=Pr(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var o=this.__data__;return r?o[i]!==void 0:e.call(o,i)}return _n=n,_n}var dn,Sa;function Vu(){if(Sa)return dn;Sa=1;var r=Pr(),t="__lodash_hash_undefined__";function e(n,i){var o=this.__data__;return this.size+=this.has(n)?0:1,o[n]=r&&i===void 0?t:i,this}return dn=e,dn}var ln,wa;function Zu(){if(wa)return ln;wa=1;var r=Gu(),t=Yu(),e=Ju(),n=Xu(),i=Vu();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var f=a[s];this.set(f[0],f[1])}}return o.prototype.clear=r,o.prototype.delete=t,o.prototype.get=e,o.prototype.has=n,o.prototype.set=i,ln=o,ln}var vn,ba;function Qu(){if(ba)return vn;ba=1;function r(){this.__data__=[],this.size=0}return vn=r,vn}var yn,Ia;function tf(){if(Ia)return yn;Ia=1;function r(t,e){return t===e||t!==t&&e!==e}return yn=r,yn}var gn,qa;function Nr(){if(qa)return gn;qa=1;var r=tf();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return gn=t,gn}var mn,Ma;function rf(){if(Ma)return mn;Ma=1;var r=Nr(),t=Array.prototype,e=t.splice;function n(i){var o=this.__data__,a=r(o,i);if(a<0)return!1;var s=o.length-1;return a==s?o.pop():e.call(o,a,1),--this.size,!0}return mn=n,mn}var Sn,Oa;function ef(){if(Oa)return Sn;Oa=1;var r=Nr();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return Sn=t,Sn}var wn,Ea;function nf(){if(Ea)return wn;Ea=1;var r=Nr();function t(e){return r(this.__data__,e)>-1}return wn=t,wn}var bn,Ta;function of(){if(Ta)return bn;Ta=1;var r=Nr();function t(e,n){var i=this.__data__,o=r(i,e);return o<0?(++this.size,i.push([e,n])):i[o][1]=n,this}return bn=t,bn}var In,Ra;function af(){if(Ra)return In;Ra=1;var r=Qu(),t=rf(),e=ef(),n=nf(),i=of();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var f=a[s];this.set(f[0],f[1])}}return o.prototype.clear=r,o.prototype.delete=t,o.prototype.get=e,o.prototype.has=n,o.prototype.set=i,In=o,In}var qn,za;function sf(){if(za)return qn;za=1;var r=da(),t=xe(),e=r(t,"Map");return qn=e,qn}var Mn,Ca;function uf(){if(Ca)return Mn;Ca=1;var r=Zu(),t=af(),e=sf();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return Mn=n,Mn}var On,Aa;function ff(){if(Aa)return On;Aa=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return On=r,On}var En,$a;function Dr(){if($a)return En;$a=1;var r=ff();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return En=t,En}var Tn,ka;function cf(){if(ka)return Tn;ka=1;var r=Dr();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return Tn=t,Tn}var Rn,Ba;function hf(){if(Ba)return Rn;Ba=1;var r=Dr();function t(e){return r(this,e).get(e)}return Rn=t,Rn}var zn,ja;function pf(){if(ja)return zn;ja=1;var r=Dr();function t(e){return r(this,e).has(e)}return zn=t,zn}var Cn,xa;function _f(){if(xa)return Cn;xa=1;var r=Dr();function t(e,n){var i=r(this,e),o=i.size;return i.set(e,n),this.size+=i.size==o?0:1,this}return Cn=t,Cn}var An,La;function df(){if(La)return An;La=1;var r=uf(),t=cf(),e=hf(),n=pf(),i=_f();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var f=a[s];this.set(f[0],f[1])}}return o.prototype.clear=r,o.prototype.delete=t,o.prototype.get=e,o.prototype.has=n,o.prototype.set=i,An=o,An}var $n,Pa;function lf(){if(Pa)return $n;Pa=1;var r=df(),t="Expected a function";function e(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var a=arguments,s=i?i.apply(this,a):a[0],u=o.cache;if(u.has(s))return u.get(s);var f=n.apply(this,a);return o.cache=u.set(s,f)||u,f};return o.cache=new(e.Cache||r),o}return e.Cache=r,$n=e,$n}var kn,Na;function vf(){if(Na)return kn;Na=1;var r=lf(),t=500;function e(n){var i=r(n,function(a){return o.size===t&&o.clear(),a}),o=i.cache;return i}return kn=e,kn}var Bn,Da;function yf(){if(Da)return Bn;Da=1;var r=vf(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,n=r(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(a,s,u,f){o.push(u?f.replace(e,"$1"):s||a)}),o});return Bn=n,Bn}var jn,Fa;function gf(){if(Fa)return jn;Fa=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,o=Array(i);++n<i;)o[n]=e(t[n],n,t);return o}return jn=r,jn}var xn,Ua;function Ln(){if(Ua)return xn;Ua=1;var r=Br(),t=gf(),e=Mt(),n=Lr(),i=r?r.prototype:void 0,o=i?i.toString:void 0;function a(s){if(typeof s=="string")return s;if(e(s))return t(s,a)+"";if(n(s))return o?o.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return xn=a,xn}var Pn,Ha;function Nn(){if(Ha)return Pn;Ha=1;var r=Ln();function t(e){return e==null?"":r(e)}return Pn=t,Pn}var Dn,Ka;function mf(){if(Ka)return Dn;Ka=1;var r=Mt(),t=Nu(),e=yf(),n=Nn();function i(o,a){return r(o)?o:t(o,a)?[o]:e(n(o))}return Dn=i,Dn}var Fn,Wa;function Sf(){if(Wa)return Fn;Wa=1;var r=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function e(n,i){var o=typeof n;return i=i??r,!!i&&(o=="number"||o!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return Fn=e,Fn}var Un,Ga;function wf(){if(Ga)return Un;Ga=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return Un=t,Un}var Hn,Ya;function bf(){if(Ya)return Hn;Ya=1;var r=Lr();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return Hn=t,Hn}var Kn,Ja;function If(){if(Ja)return Kn;Ja=1;var r=mf(),t=Vo(),e=Mt(),n=Sf(),i=wf(),o=bf();function a(s,u,f){u=r(u,s);for(var c=-1,h=u.length,p=!1;++c<h;){var _=o(u[c]);if(!(p=s!=null&&f(s,_)))break;s=s[_]}return p||++c!=h?p:(h=s==null?0:s.length,!!h&&i(h)&&n(_,h)&&(e(s)||t(s)))}return Kn=a,Kn}var Wn,Xa;function qf(){if(Xa)return Wn;Xa=1;var r=Pu(),t=If();function e(n,i){return n!=null&&t(n,i,r)}return Wn=e,Wn}qf();var Gn,Va;function Mf(){if(Va)return Gn;Va=1;var r=Math.max,t=Math.min;function e(n,i,o){return n>=t(i,o)&&n<r(i,o)}return Gn=e,Gn}var Yn,Za;function Of(){if(Za)return Yn;Za=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return Yn=t,Yn}var Jn,Qa;function Ef(){if(Qa)return Jn;Qa=1;var r=Of(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return Jn=e,Jn}var Xn,ts;function rs(){if(ts)return Xn;ts=1;var r=Ef(),t=tn(),e=Lr(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function u(f){if(typeof f=="number")return f;if(e(f))return n;if(t(f)){var c=typeof f.valueOf=="function"?f.valueOf():f;f=t(c)?c+"":c}if(typeof f!="string")return f===0?f:+f;f=r(f);var h=o.test(f);return h||a.test(f)?s(f.slice(2),h?2:8):i.test(f)?n:+f}return Xn=u,Xn}var Vn,es;function ns(){if(es)return Vn;es=1;var r=rs(),t=1/0,e=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===t||i===-t){var o=i<0?-1:1;return o*e}return i===i?i:0}return Vn=n,Vn}var Zn,is;function Tf(){if(is)return Zn;is=1;var r=Mf(),t=ns(),e=rs();function n(i,o,a){return o=t(o),a===void 0?(a=o,o=0):a=t(a),i=e(i),r(i,o,a)}return Zn=n,Zn}var Rf=Tf();const zf=zu(Rf);var Qn,os;function ti(){if(os)return Qn;os=1;var r=ns();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return Qn=t,Qn}var ri,as;function Cf(){if(as)return ri;as=1;var r=ti();function t(e){return typeof e=="number"&&e==r(e)}return ri=t,ri}Cf();var ei,ss;function us(){if(ss)return ei;ss=1;function r(t,e,n){var i=-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 a=Array(o);++i<o;)a[i]=t[i+e];return a}return ei=r,ei}var ni,fs;function Af(){if(fs)return ni;fs=1;var r=us(),t=ti();function e(n,i,o){return n&&n.length?(i=o||i===void 0?1:t(i),r(n,0,i<0?0:i)):[]}return ni=e,ni}Af();const lr="black",vr="white",nt=null;class cs extends $({dimensions:19,moves:B()},"Board"){constructor(t=19,...e){super({dimensions:t,moves:B(e.map(n=>[n.coordinate,n.color]))})}toMap(t=null){const e={[lr]:lr,[vr]:vr,[nt]:nt},n=t||e;return Array(this.dimensions).fill(nt).map((i,o)=>Array(this.dimensions).fill(nt).map((a,s)=>{const u=this.moves.get(ot(s,o),nt);return n[u]||e[u]}))}}function hs(...r){return Reflect.construct(cs,r)}hs.prototype=cs.prototype;class ps extends $({x:0,y:0},"Coordinate"){constructor(t,e){super({x:t,y:e})}}function ot(...r){return Reflect.construct(ps,r)}ot.prototype=ps.prototype;class _s extends $({coordinate:ot(),color:nt},"Move"){constructor(t,e){super({coordinate:t,color:e})}}function ds(...r){return Reflect.construct(_s,r)}ds.prototype=_s.prototype,ot(4,4),ot(6,6),ot(9,9);function $f(r,t){const{x:e,y:n}=t,i=o=>zf(o,r.dimensions);return _t.of(ot(e,n+1),ot(e,n-1),ot(e+1,n),ot(e-1,n)).filter(o=>i(o.x)&&i(o.y))}function Fr(r,t,e){const n=e===void 0?r.moves.get(t,nt):e;return $f(r,t).filter(i=>r.moves.get(i,nt)===n)}function ls(r,t){let e=_t(),n=_t.of(t);for(;!n.isEmpty();){const i=n.first(),o=Fr(r,i);e=e.add(i),n=n.rest().union(o.subtract(e))}return e}function ii(r){return r===lr?vr:r===vr?lr:nt}function kf(r,t){return ls(r,t).reduce((e,n)=>e.union(Fr(r,n,nt)),_t())}function oi(r,t){return kf(r,t).size}function vs(r,t){const e=oi(r.setIn(["moves",t.coordinate],t.color),t.coordinate)>0,n=Fr(r,t.coordinate,ii(t.color)).some(i=>oi(r,i)===1);return e||n}function Bf(r,t){return r.setIn(["moves"],t.reduce((e,n)=>e.delete(n),r.moves))}function jf(r,t){if(!vs(r,t))throw new Error("Not a valid position");if(r.moves.has(t.coordinate))throw new Error("There is already a stone there");const e=Fr(r,t.coordinate,ii(t.color)).reduce((n,i)=>n.union(oi(r,i)===1?ls(r,i):_t()),_t());return Bf(r,e).setIn(["moves",t.coordinate],t.color)}function xf(r,t,e,n=!1){const i=r.moves.get(t,nt);if(!n&&ii(i)===e)throw new Error("There is already a stone there. Pass force=true to override.");return r.setIn(["moves",t],e)}const yt={BLACK:lr,Board:hs,Coordinate:ot,EMPTY:nt,Move:ds,WHITE:vr,addMove:jf,isLegalMove:vs,placeStone:xf};Mt();var ai,ys;function Lf(){if(ys)return ai;ys=1;var r=jr(),t=Mt(),e=xr(),n="[object String]";function i(o){return typeof o=="string"||!t(o)&&e(o)&&r(o)==n}return ai=i,ai}Lf();var si,gs;function Pf(){if(gs)return si;gs=1;function r(t,e,n){return t===t&&(n!==void 0&&(t=t<=n?t:n),e!==void 0&&(t=t>=e?t:e)),t}return si=r,si}var ui,ms;function Nf(){if(ms)return ui;ms=1;var r=Pf(),t=Ln(),e=ti(),n=Nn();function i(o,a,s){return o=n(o),s=s==null?0:r(e(s),0,o.length),a=t(a),o.slice(s,s+a.length)==a}return ui=i,ui}Nf();var fi,Ss;function Df(){if(Ss)return fi;Ss=1;var r=us();function t(e,n,i){var o=e.length;return i=i===void 0?o:i,!n&&i>=o?e:r(e,n,i)}return fi=t,fi}var ci,ws;function Ff(){if(ws)return ci;ws=1;function r(t,e,n,i){for(var o=t.length,a=n+(i?1:-1);i?a--:++a<o;)if(e(t[a],a,t))return a;return-1}return ci=r,ci}var hi,bs;function Uf(){if(bs)return hi;bs=1;function r(t){return t!==t}return hi=r,hi}var pi,Is;function Hf(){if(Is)return pi;Is=1;function r(t,e,n){for(var i=n-1,o=t.length;++i<o;)if(t[i]===e)return i;return-1}return pi=r,pi}var _i,qs;function Kf(){if(qs)return _i;qs=1;var r=Ff(),t=Uf(),e=Hf();function n(i,o,a){return o===o?e(i,o,a):r(i,t,a)}return _i=n,_i}var di,Ms;function Wf(){if(Ms)return di;Ms=1;var r=Kf();function t(e,n){for(var i=-1,o=e.length;++i<o&&r(n,e[i],0)>-1;);return i}return di=t,di}var li,Os;function Gf(){if(Os)return li;Os=1;function r(t){return t.split("")}return li=r,li}var vi,Es;function Yf(){if(Es)return vi;Es=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,o="\\ufe0e\\ufe0f",a="\\u200d",s=RegExp("["+a+r+i+o+"]");function u(f){return s.test(f)}return vi=u,vi}var yi,Ts;function Jf(){if(Ts)return yi;Ts=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,o="\\ufe0e\\ufe0f",a="["+r+"]",s="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",f="(?:"+s+"|"+u+")",c="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",_="\\u200d",d=f+"?",v="["+o+"]?",w="(?:"+_+"(?:"+[c,h,p].join("|")+")"+v+d+")*",I=v+d+w,y="(?:"+[c+s+"?",s,h,p,a].join("|")+")",l=RegExp(u+"(?="+u+")|"+y+I,"g");function g(A){return A.match(l)||[]}return yi=g,yi}var gi,Rs;function Xf(){if(Rs)return gi;Rs=1;var r=Gf(),t=Yf(),e=Jf();function n(i){return t(i)?e(i):r(i)}return gi=n,gi}var mi,zs;function Vf(){if(zs)return mi;zs=1;var r=Ln(),t=Df(),e=Wf(),n=Xf(),i=Nn(),o=/^\s+/;function a(s,u,f){if(s=i(s),s&&(f||u===void 0))return s.replace(o,"");if(!s||!(u=r(u)))return s;var c=n(s),h=e(c,n(u));return t(c,h).join("")}return mi=a,mi}Vf();const K=yt.BLACK,Si=yt.Board,Ot=yt.Coordinate,yr=yt.EMPTY,kt=yt.Move,at=yt.WHITE,Xt=yt.addMove,Cs=yt.isLegalMove,Zf=yt.placeStone;function Ur(r){return`
|
|
1
|
+
(function(zt,gt){typeof exports=="object"&&typeof module<"u"?gt(exports):typeof define=="function"&&define.amd?define(["exports"],gt):(zt=typeof globalThis<"u"?globalThis:zt||self,gt(zt.GodashDiagrams={}))})(this,(function(zt){"use strict";var gt="@@__IMMUTABLE_INDEXED__@@";function tt(r){return!!(r&&r[gt])}var Sr="@@__IMMUTABLE_KEYED__@@";function C(r){return!!(r&&r[Sr])}function Kr(r){return C(r)||tt(r)}var Mi="@@__IMMUTABLE_ITERABLE__@@";function G(r){return!!(r&&r[Mi])}var P=function(t){return G(t)?t:K(t)},rt=(function(r){function t(e){return C(e)?e:wt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(P),Ct=(function(r){function t(e){return tt(e)?e:it(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(P),xt=(function(r){function t(e){return G(e)&&!Kr(e)?e:Dt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(P);P.Keyed=rt,P.Indexed=Ct,P.Set=xt;var Lt=0,Y=1,J=2,Wr=typeof Symbol=="function"&&Symbol.iterator,Oi="@@iterator",wr=Wr||Oi,S=function(t){this.next=t};S.prototype.toString=function(){return"[Iterator]"},S.KEYS=Lt,S.VALUES=Y,S.ENTRIES=J,S.prototype.inspect=S.prototype.toSource=function(){return this.toString()},S.prototype[wr]=function(){return this};function A(r,t,e,n){var i=r===Lt?t:r===Y?e:[t,e];return n?n.value=i:n={value:i,done:!1},n}function D(){return{value:void 0,done:!0}}function Ei(r){return Array.isArray(r)?!0:!!br(r)}function Ti(r){return!!(r&&typeof r.next=="function")}function Gr(r){var t=br(r);return t&&t.call(r)}function br(r){var t=r&&(Wr&&r[Wr]||r[Oi]);if(typeof t=="function")return t}function js(r){var t=br(r);return t&&t===r.entries}function xs(r){var t=br(r);return t&&t===r.keys}var Zt="delete",O=5,X=1<<O,F=X-1,m={};function Yr(){return{value:!1}}function et(r){r&&(r.value=!0)}function Jr(){}function Pt(r){return r.size===void 0&&(r.size=r.__iterate(Ri)),r.size}function mt(r,t){if(typeof t!="number"){var e=t>>>0;if(""+e!==t||e===4294967295)return NaN;t=e}return t<0?Pt(r)+t:t}function Ri(){return!0}function Ir(r,t,e){return(r===0&&!Ci(r)||e!==void 0&&r<=-e)&&(t===void 0||e!==void 0&&t>=e)}function Qt(r,t){return zi(r,t,0)}function qr(r,t){return zi(r,t,t)}function zi(r,t,e){return r===void 0?e:Ci(r)?t===1/0?t:Math.max(0,t+r)|0:t===void 0||t===r?r:Math.min(t,r)|0}function Ci(r){return r<0||r===0&&1/r===-1/0}var Ai="@@__IMMUTABLE_RECORD__@@";function At(r){return!!(r&&r[Ai])}function ut(r){return G(r)||At(r)}var St="@@__IMMUTABLE_ORDERED__@@";function ft(r){return!!(r&&r[St])}var $i="@@__IMMUTABLE_SEQ__@@";function Xr(r){return!!(r&&r[$i])}var Nt=Object.prototype.hasOwnProperty;function ki(r){return Array.isArray(r)||typeof r=="string"?!0:r&&typeof r=="object"&&Number.isInteger(r.length)&&r.length>=0&&(r.length===0?Object.keys(r).length===1:r.hasOwnProperty(r.length-1))}var K=(function(r){function t(e){return e==null?Zr():ut(e)?e.toSeq():Ps(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(n,i){var o=this._cache;if(o){for(var a=o.length,s=0;s!==a;){var u=o[i?a-++s:s++];if(n(u[1],u[0],this)===!1)break}return s}return this.__iterateUncached(n,i)},t.prototype.__iterator=function(n,i){var o=this._cache;if(o){var a=o.length,s=0;return new S(function(){if(s===a)return D();var u=o[i?a-++s:s++];return A(n,u[0],u[1])})}return this.__iteratorUncached(n,i)},t})(P),wt=(function(r){function t(e){return e==null?Zr().toKeyedSeq():G(e)?C(e)?e.toSeq():e.fromEntrySeq():At(e)?e.toSeq():Qr(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t})(K),it=(function(r){function t(e){return e==null?Zr():G(e)?C(e)?e.entrySeq():e.toIndexedSeq():At(e)?e.toSeq().entrySeq():ji(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t})(K),Dt=(function(r){function t(e){return(G(e)&&!Kr(e)?e:it(e)).toSetSeq()}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t})(K);K.isSeq=Xr,K.Keyed=wt,K.Set=Dt,K.Indexed=it,K.prototype[$i]=!0;var Ft=(function(r){function t(e){this._array=e,this.size=e.length}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return this.has(n)?this._array[mt(this,n)]:i},t.prototype.__iterate=function(n,i){for(var o=this._array,a=o.length,s=0;s!==a;){var u=i?a-++s:s++;if(n(o[u],u,this)===!1)break}return s},t.prototype.__iterator=function(n,i){var o=this._array,a=o.length,s=0;return new S(function(){if(s===a)return D();var u=i?a-++s:s++;return A(n,u,o[u])})},t})(it),Vr=(function(r){function t(e){var n=Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]);this._object=e,this._keys=n,this.size=n.length}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return i!==void 0&&!this.has(n)?i:this._object[n]},t.prototype.has=function(n){return Nt.call(this._object,n)},t.prototype.__iterate=function(n,i){for(var o=this._object,a=this._keys,s=a.length,u=0;u!==s;){var f=a[i?s-++u:u++];if(n(o[f],f,this)===!1)break}return u},t.prototype.__iterator=function(n,i){var o=this._object,a=this._keys,s=a.length,u=0;return new S(function(){if(u===s)return D();var f=a[i?s-++u:u++];return A(n,f,o[f])})},t})(wt);Vr.prototype[St]=!0;var Ls=(function(r){function t(e){this._collection=e,this.size=e.length||e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(n,i){if(i)return this.cacheResult().__iterate(n,i);var o=this._collection,a=Gr(o),s=0;if(Ti(a))for(var u;!(u=a.next()).done&&n(u.value,s++,this)!==!1;);return s},t.prototype.__iteratorUncached=function(n,i){if(i)return this.cacheResult().__iterator(n,i);var o=this._collection,a=Gr(o);if(!Ti(a))return new S(D);var s=0;return new S(function(){var u=a.next();return u.done?u:A(n,s++,u.value)})},t})(it),Bi;function Zr(){return Bi||(Bi=new Ft([]))}function Qr(r){var t=te(r);if(t)return t.fromEntrySeq();if(typeof r=="object")return new Vr(r);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+r)}function ji(r){var t=te(r);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+r)}function Ps(r){var t=te(r);if(t)return js(r)?t.fromEntrySeq():xs(r)?t.toSetSeq():t;if(typeof r=="object")return new Vr(r);throw new TypeError("Expected Array or collection object of values, or keyed object: "+r)}function te(r){return ki(r)?new Ft(r):Ei(r)?new Ls(r):void 0}function tr(){return this.__ensureOwner()}function rr(){return this.__ownerID?this:this.__ensureOwner(new Jr)}var er=typeof Math.imul=="function"&&Math.imul(4294967295,2)===-2?Math.imul:function(t,e){t|=0,e|=0;var n=t&65535,i=e&65535;return n*i+((t>>>16)*i+n*(e>>>16)<<16>>>0)|0};function Mr(r){return r>>>1&1073741824|r&3221225471}var Ns=Object.prototype.valueOf;function V(r){if(r==null)return xi(r);if(typeof r.hashCode=="function")return Mr(r.hashCode(r));var t=Ws(r);if(t==null)return xi(t);switch(typeof t){case"boolean":return t?1108378657:1108378656;case"number":return Ds(t);case"string":return t.length>Gs?Fs(t):re(t);case"object":case"function":return Hs(t);case"symbol":return Us(t);default:if(typeof t.toString=="function")return re(t.toString());throw new Error("Value type "+typeof t+" cannot be hashed.")}}function xi(r){return r===null?1108378658:1108378659}function Ds(r){if(r!==r||r===1/0)return 0;var t=r|0;for(t!==r&&(t^=r*4294967295);r>4294967295;)r/=4294967295,t^=r;return Mr(t)}function Fs(r){var t=ae[r];return t===void 0&&(t=re(r),oe===Ys&&(oe=0,ae={}),oe++,ae[r]=t),t}function re(r){for(var t=0,e=0;e<r.length;e++)t=31*t+r.charCodeAt(e)|0;return Mr(t)}function Us(r){var t=Di[r];return t!==void 0||(t=Ni(),Di[r]=t),t}function Hs(r){var t;if(ee&&(t=ne.get(r),t!==void 0)||(t=r[$t],t!==void 0)||!Pi&&(t=r.propertyIsEnumerable&&r.propertyIsEnumerable[$t],t!==void 0||(t=Ks(r),t!==void 0)))return t;if(t=Ni(),ee)ne.set(r,t);else{if(Li!==void 0&&Li(r)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(Pi)Object.defineProperty(r,$t,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(r.propertyIsEnumerable!==void 0&&r.propertyIsEnumerable===r.constructor.prototype.propertyIsEnumerable)r.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},r.propertyIsEnumerable[$t]=t;else if(r.nodeType!==void 0)r[$t]=t;else throw new Error("Unable to set a non-enumerable property on object.")}return t}var Li=Object.isExtensible,Pi=(function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}})();function Ks(r){if(r&&r.nodeType>0)switch(r.nodeType){case 1:return r.uniqueID;case 9:return r.documentElement&&r.documentElement.uniqueID}}function Ws(r){return r.valueOf!==Ns&&typeof r.valueOf=="function"?r.valueOf(r):r}function Ni(){var r=++ie;return ie&1073741824&&(ie=0),r}var ee=typeof WeakMap=="function",ne;ee&&(ne=new WeakMap);var Di=Object.create(null),ie=0,$t="__immutablehash__";typeof Symbol=="function"&&($t=Symbol($t));var Gs=16,Ys=255,oe=0,ae={},Or=(function(r){function t(e,n){this._iter=e,this._useKeys=n,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n,i){return this._iter.get(n,i)},t.prototype.has=function(n){return this._iter.has(n)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var n=this,i=se(this,!0);return this._useKeys||(i.valueSeq=function(){return n._iter.toSeq().reverse()}),i},t.prototype.map=function(n,i){var o=this,a=Wi(this,n,i);return this._useKeys||(a.valueSeq=function(){return o._iter.toSeq().map(n,i)}),a},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a,s){return n(a,s,o)},i)},t.prototype.__iterator=function(n,i){return this._iter.__iterator(n,i)},t})(wt);Or.prototype[St]=!0;var Fi=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.includes=function(n){return this._iter.includes(n)},t.prototype.__iterate=function(n,i){var o=this,a=0;return i&&Pt(this),this._iter.__iterate(function(s){return n(s,i?o.size-++a:a++,o)},i)},t.prototype.__iterator=function(n,i){var o=this,a=this._iter.__iterator(Y,i),s=0;return i&&Pt(this),new S(function(){var u=a.next();return u.done?u:A(n,i?o.size-++s:s++,u.value,u)})},t})(it),Ui=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.has=function(n){return this._iter.includes(n)},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a){return n(a,a,o)},i)},t.prototype.__iterator=function(n,i){var o=this._iter.__iterator(Y,i);return new S(function(){var a=o.next();return a.done?a:A(n,a.value,a.value,a)})},t})(Dt),Hi=(function(r){function t(e){this._iter=e,this.size=e.size}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a){if(a){Vi(a);var s=G(a);return n(s?a.get(1):a[1],s?a.get(0):a[0],o)}},i)},t.prototype.__iterator=function(n,i){var o=this._iter.__iterator(Y,i);return new S(function(){for(;;){var a=o.next();if(a.done)return a;var s=a.value;if(s){Vi(s);var u=G(s);return A(n,u?s.get(0):s[0],u?s.get(1):s[1],a)}}})},t})(wt);Fi.prototype.cacheResult=Or.prototype.cacheResult=Ui.prototype.cacheResult=Hi.prototype.cacheResult=ce;function Ki(r){var t=ct(r);return t._iter=r,t.size=r.size,t.flip=function(){return r},t.reverse=function(){var e=r.reverse.apply(this);return e.flip=function(){return r.reverse()},e},t.has=function(e){return r.includes(e)},t.includes=function(e){return r.has(e)},t.cacheResult=ce,t.__iterateUncached=function(e,n){var i=this;return r.__iterate(function(o,a){return e(a,o,i)!==!1},n)},t.__iteratorUncached=function(e,n){if(e===J){var i=r.__iterator(e,n);return new S(function(){var o=i.next();if(!o.done){var a=o.value[0];o.value[0]=o.value[1],o.value[1]=a}return o})}return r.__iterator(e===Y?Lt:Y,n)},t}function Wi(r,t,e){var n=ct(r);return n.size=r.size,n.has=function(i){return r.has(i)},n.get=function(i,o){var a=r.get(i,m);return a===m?o:t.call(e,a,i,r)},n.__iterateUncached=function(i,o){var a=this;return r.__iterate(function(s,u,f){return i(t.call(e,s,u,f),u,a)!==!1},o)},n.__iteratorUncached=function(i,o){var a=r.__iterator(J,o);return new S(function(){var s=a.next();if(s.done)return s;var u=s.value,f=u[0];return A(i,f,t.call(e,u[1],f,r),s)})},n}function se(r,t){var e=this,n=ct(r);return n._iter=r,n.size=r.size,n.reverse=function(){return r},r.flip&&(n.flip=function(){var i=Ki(r);return i.reverse=function(){return r.flip()},i}),n.get=function(i,o){return r.get(t?i:-1-i,o)},n.has=function(i){return r.has(t?i:-1-i)},n.includes=function(i){return r.includes(i)},n.cacheResult=ce,n.__iterate=function(i,o){var a=this,s=0;return o&&Pt(r),r.__iterate(function(u,f){return i(u,t?f:o?a.size-++s:s++,a)},!o)},n.__iterator=function(i,o){var a=0;o&&Pt(r);var s=r.__iterator(J,!o);return new S(function(){var u=s.next();if(u.done)return u;var f=u.value;return A(i,t?f[0]:o?e.size-++a:a++,f[1],u)})},n}function Gi(r,t,e,n){var i=ct(r);return n&&(i.has=function(o){var a=r.get(o,m);return a!==m&&!!t.call(e,a,o,r)},i.get=function(o,a){var s=r.get(o,m);return s!==m&&t.call(e,s,o,r)?s:a}),i.__iterateUncached=function(o,a){var s=this,u=0;return r.__iterate(function(f,c,h){if(t.call(e,f,c,h))return u++,o(f,n?c:u-1,s)},a),u},i.__iteratorUncached=function(o,a){var s=r.__iterator(J,a),u=0;return new S(function(){for(;;){var f=s.next();if(f.done)return f;var c=f.value,h=c[0],p=c[1];if(t.call(e,p,h,r))return A(o,n?h:u++,p,f)}})},i}function Js(r,t,e){var n=j().asMutable();return r.__iterate(function(i,o){n.update(t.call(e,i,o,r),0,function(a){return a+1})}),n.asImmutable()}function Xs(r,t,e){var n=C(r),i=(ft(r)?vt():j()).asMutable();r.__iterate(function(a,s){i.update(t.call(e,a,s,r),function(u){return u=u||[],u.push(n?[s,a]:a),u})});var o=fe(r);return i.map(function(a){return E(r,o(a))}).asImmutable()}function Vs(r,t,e){var n=C(r),i=[[],[]];r.__iterate(function(a,s){i[t.call(e,a,s,r)?1:0].push(n?[s,a]:a)});var o=fe(r);return i.map(function(a){return E(r,o(a))})}function ue(r,t,e,n){var i=r.size;if(Ir(t,e,i))return r;if(typeof i>"u"&&(t<0||e<0))return ue(r.toSeq().cacheResult(),t,e,n);var o=Qt(t,i),a=qr(e,i),s=a-o,u;s===s&&(u=s<0?0:s);var f=ct(r);return f.size=u===0?u:r.size&&u||void 0,!n&&Xr(r)&&u>=0&&(f.get=function(c,h){return c=mt(this,c),c>=0&&c<u?r.get(c+o,h):h}),f.__iterateUncached=function(c,h){var p=this;if(u===0)return 0;if(h)return this.cacheResult().__iterate(c,h);var _=0,d=!0,v=0;return r.__iterate(function(w,I){if(!(d&&(d=_++<o)))return v++,c(w,n?I:v-1,p)!==!1&&v!==u}),v},f.__iteratorUncached=function(c,h){if(u!==0&&h)return this.cacheResult().__iterator(c,h);if(u===0)return new S(D);var p=r.__iterator(c,h),_=0,d=0;return new S(function(){for(;_++<o;)p.next();if(++d>u)return D();var v=p.next();return n||c===Y||v.done?v:c===Lt?A(c,d-1,void 0,v):A(c,d-1,v.value[1],v)})},f}function Zs(r,t,e){var n=ct(r);return n.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=0;return r.__iterate(function(u,f,c){return t.call(e,u,f,c)&&++s&&i(u,f,a)}),s},n.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=r.__iterator(J,o),u=!0;return new S(function(){if(!u)return D();var f=s.next();if(f.done)return f;var c=f.value,h=c[0],p=c[1];return t.call(e,p,h,a)?i===J?f:A(i,h,p,f):(u=!1,D())})},n}function Yi(r,t,e,n){var i=ct(r);return i.__iterateUncached=function(o,a){var s=this;if(a)return this.cacheResult().__iterate(o,a);var u=!0,f=0;return r.__iterate(function(c,h,p){if(!(u&&(u=t.call(e,c,h,p))))return f++,o(c,n?h:f-1,s)}),f},i.__iteratorUncached=function(o,a){var s=this;if(a)return this.cacheResult().__iterator(o,a);var u=r.__iterator(J,a),f=!0,c=0;return new S(function(){var h,p,_;do{if(h=u.next(),h.done)return n||o===Y?h:o===Lt?A(o,c++,void 0,h):A(o,c++,h.value[1],h);var d=h.value;p=d[0],_=d[1],f&&(f=t.call(e,_,p,s))}while(f);return o===J?h:A(o,p,_,h)})},i}var Qs=(function(r){function t(e){this._wrappedIterables=e.flatMap(function(n){return n._wrappedIterables?n._wrappedIterables:[n]}),this.size=this._wrappedIterables.reduce(function(n,i){if(n!==void 0){var o=i.size;if(o!==void 0)return n+o}},0),this[Sr]=this._wrappedIterables[0][Sr],this[gt]=this._wrappedIterables[0][gt],this[St]=this._wrappedIterables[0][St]}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(n,i){if(this._wrappedIterables.length!==0){if(i)return this.cacheResult().__iterate(n,i);for(var o=0,a=C(this),s=a?J:Y,u=this._wrappedIterables[o].__iterator(s,i),f=!0,c=0;f;){for(var h=u.next();h.done;){if(o++,o===this._wrappedIterables.length)return c;u=this._wrappedIterables[o].__iterator(s,i),h=u.next()}var p=a?n(h.value[1],h.value[0],this):n(h.value,c,this);f=p!==!1,c++}return c}},t.prototype.__iteratorUncached=function(n,i){var o=this;if(this._wrappedIterables.length===0)return new S(D);if(i)return this.cacheResult().__iterator(n,i);var a=0,s=this._wrappedIterables[a].__iterator(n,i);return new S(function(){for(var u=s.next();u.done;){if(a++,a===o._wrappedIterables.length)return u;s=o._wrappedIterables[a].__iterator(n,i),u=s.next()}return u})},t})(K);function tu(r,t){var e=C(r),n=[r].concat(t).map(function(o){return G(o)?e&&(o=rt(o)):o=e?Qr(o):ji(Array.isArray(o)?o:[o]),o}).filter(function(o){return o.size!==0});if(n.length===0)return r;if(n.length===1){var i=n[0];if(i===r||e&&C(i)||tt(r)&&tt(i))return i}return new Qs(n)}function Ji(r,t,e){var n=ct(r);return n.__iterateUncached=function(i,o){if(o)return this.cacheResult().__iterate(i,o);var a=0,s=!1;function u(f,c){f.__iterate(function(h,p){return(!t||c<t)&&G(h)?u(h,c+1):(a++,i(h,e?p:a-1,n)===!1&&(s=!0)),!s},o)}return u(r,0),a},n.__iteratorUncached=function(i,o){if(o)return this.cacheResult().__iterator(i,o);var a=r.__iterator(i,o),s=[],u=0;return new S(function(){for(;a;){var f=a.next();if(f.done!==!1){a=s.pop();continue}var c=f.value;if(i===J&&(c=c[1]),(!t||s.length<t)&&G(c))s.push(a),a=c.__iterator(i,o);else return e?f:A(i,u++,c,f)}return D()})},n}function ru(r,t,e){var n=fe(r);return r.toSeq().map(function(i,o){return n(t.call(e,i,o,r))}).flatten(!0)}function eu(r,t){var e=ct(r);return e.size=r.size&&r.size*2-1,e.__iterateUncached=function(n,i){var o=this,a=0;return r.__iterate(function(s){return(!a||n(t,a++,o)!==!1)&&n(s,a++,o)!==!1},i),a},e.__iteratorUncached=function(n,i){var o=r.__iterator(Y,i),a=0,s;return new S(function(){return(!s||a%2)&&(s=o.next(),s.done)?s:a%2?A(n,a++,t):A(n,a++,s.value,s)})},e}function Ut(r,t,e){t||(t=Zi);var n=C(r),i=0,o=r.toSeq().map(function(a,s){return[s,a,i++,e?e(a,s,r):a]}).valueSeq().toArray();return o.sort(function(a,s){return t(a[3],s[3])||a[2]-s[2]}).forEach(n?function(a,s){o[s].length=2}:function(a,s){o[s]=a[1]}),n?wt(o):tt(r)?it(o):Dt(o)}function Er(r,t,e){if(t||(t=Zi),e){var n=r.toSeq().map(function(i,o){return[i,e(i,o,r)]}).reduce(function(i,o){return Xi(t,i[1],o[1])?o:i});return n&&n[0]}return r.reduce(function(i,o){return Xi(t,i,o)?o:i})}function Xi(r,t,e){var n=r(e,t);return n===0&&e!==t&&(e==null||e!==e)||n>0}function Tr(r,t,e,n){var i=ct(r),o=new Ft(e).map(function(a){return a.size});return i.size=n?o.max():o.min(),i.__iterate=function(a,s){for(var u=this.__iterator(Y,s),f,c=0;!(f=u.next()).done&&a(f.value,c++,this)!==!1;);return c},i.__iteratorUncached=function(a,s){var u=e.map(function(h){return h=P(h),Gr(s?h.reverse():h)}),f=0,c=!1;return new S(function(){var h;return c||(h=u.map(function(p){return p.next()}),c=n?h.every(function(p){return p.done}):h.some(function(p){return p.done})),c?D():A(a,f++,t.apply(null,h.map(function(p){return p.value})))})},i}function E(r,t){return r===t?r:Xr(r)?t:r.constructor(t)}function Vi(r){if(r!==Object(r))throw new TypeError("Expected [K, V] tuple: "+r)}function fe(r){return C(r)?rt:tt(r)?Ct:xt}function ct(r){return Object.create((C(r)?wt:tt(r)?it:Dt).prototype)}function ce(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):K.prototype.cacheResult.call(this)}function Zi(r,t){return r===void 0&&t===void 0?0:r===void 0?1:t===void 0?-1:r>t?1:r<t?-1:0}function Qi(r){return!!(r&&typeof r.equals=="function"&&typeof r.hashCode=="function")}function Z(r,t){if(r===t||r!==r&&t!==t)return!0;if(!r||!t)return!1;if(typeof r.valueOf=="function"&&typeof t.valueOf=="function"){if(r=r.valueOf(),t=t.valueOf(),r===t||r!==r&&t!==t)return!0;if(!r||!t)return!1}return!!(Qi(r)&&Qi(t)&&r.equals(t))}function to(r,t,e,n){return Wt(r,[t],e,n)}function ro(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return no(this,r)}function eo(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];if(typeof r!="function")throw new TypeError("Invalid merger function: "+r);return no(this,t,r)}function no(r,t,e){for(var n=[],i=0;i<t.length;i++){var o=rt(t[i]);o.size!==0&&n.push(o)}return n.length===0?r:r.toSeq().size===0&&!r.__ownerID&&n.length===1?At(r)?r:r.constructor(n[0]):r.withMutations(function(a){for(var s=e?function(f,c){to(a,c,m,function(h){return h===m?f:e(h,f,c)})}:function(f,c){a.set(c,f)},u=0;u<n.length;u++)n[u].forEach(s)})}var nu=Object.prototype.toString;function iu(r){if(!r||typeof r!="object"||nu.call(r)!=="[object Object]")return!1;var t=Object.getPrototypeOf(r);if(t===null)return!0;for(var e=t,n=Object.getPrototypeOf(t);n!==null;)e=n,n=Object.getPrototypeOf(e);return e===t}function bt(r){return typeof r=="object"&&(ut(r)||Array.isArray(r)||iu(r))}function ht(r,t){t=t||0;for(var e=Math.max(0,r.length-t),n=new Array(e),i=0;i<e;i++)n[i]=r[i+t];return n}function Rr(r){if(Array.isArray(r))return ht(r);var t={};for(var e in r)Nt.call(r,e)&&(t[e]=r[e]);return t}function he(r,t,e){return pe(r,t,ou(e))}function pe(r,t,e){if(!bt(r))throw new TypeError("Cannot merge into non-data-structure value: "+r);if(ut(r))return typeof e=="function"&&r.mergeWith?r.mergeWith.apply(r,[e].concat(t)):r.merge?r.merge.apply(r,t):r.concat.apply(r,t);for(var n=Array.isArray(r),i=r,o=n?Ct:rt,a=n?function(u){i===r&&(i=Rr(i)),i.push(u)}:function(u,f){var c=Nt.call(i,f),h=c&&e?e(i[f],u,f):u;(!c||h!==i[f])&&(i===r&&(i=Rr(i)),i[f]=h)},s=0;s<t.length;s++)o(t[s]).forEach(a);return i}function ou(r){function t(e,n,i){return bt(e)&&bt(n)&&au(e,n)?pe(e,[n],t):r?r(e,n,i):n}return t}function au(r,t){var e=K(r),n=K(t);return tt(e)===tt(n)&&C(e)===C(n)}function io(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return he(this,r)}function oo(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return he(this,t,r)}function _e(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Wt(this,r,pt(),function(n){return he(n,t)})}function de(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Wt(this,r,pt(),function(n){return pe(n,t)})}function su(r,t,e){return Wt(r,t,m,function(){return e})}function le(r,t){return su(this,r,t)}function ve(r,t,e){return arguments.length===1?r(this):to(this,r,t,e)}function ye(r,t,e){return Wt(this,r,t,e)}function ge(){return this.__altered}function nr(r){var t=this.asMutable();return r(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}var ao="@@__IMMUTABLE_MAP__@@";function me(r){return!!(r&&r[ao])}function ir(r,t){if(!r)throw new Error(t)}function Q(r){ir(r!==1/0,"Cannot perform this action with an infinite size.")}var j=(function(r){function t(e){return e==null?pt():me(e)&&!ft(e)?e:pt().withMutations(function(n){var i=r(e);Q(i.size),i.forEach(function(o,a){return n.set(a,o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(n,i){return this._root?this._root.get(0,void 0,n,i):i},t.prototype.set=function(n,i){return fo(this,n,i)},t.prototype.remove=function(n){return fo(this,n,m)},t.prototype.deleteAll=function(n){var i=P(n);return i.size===0?this:this.withMutations(function(o){i.forEach(function(a){return o.remove(a)})})},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):pt()},t.prototype.sort=function(n){return vt(Ut(this,n))},t.prototype.sortBy=function(n,i){return vt(Ut(this,i,n))},t.prototype.map=function(n,i){var o=this;return this.withMutations(function(a){a.forEach(function(s,u){a.set(u,n.call(i,s,u,o))})})},t.prototype.__iterator=function(n,i){return new uu(this,n,i)},t.prototype.__iterate=function(n,i){var o=this,a=0;return this._root&&this._root.iterate(function(s){return a++,n(s[1],s[0],o)},i),a},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?we(this.size,this._root,n,this.__hash):this.size===0?pt():(this.__ownerID=n,this.__altered=!1,this)},t})(rt);j.isMap=me;var z=j.prototype;z[ao]=!0,z[Zt]=z.remove,z.removeAll=z.deleteAll,z.setIn=le,z.removeIn=z.deleteIn=qe,z.update=ve,z.updateIn=ye,z.merge=z.concat=ro,z.mergeWith=eo,z.mergeDeep=io,z.mergeDeepWith=oo,z.mergeIn=de,z.mergeDeepIn=_e,z.withMutations=nr,z.wasAltered=ge,z.asImmutable=tr,z["@@transducer/init"]=z.asMutable=rr,z["@@transducer/step"]=function(r,t){return r.set(t[0],t[1])},z["@@transducer/result"]=function(r){return r.asImmutable()};var or=function(t,e){this.ownerID=t,this.entries=e};or.prototype.get=function(t,e,n,i){for(var o=this.entries,a=0,s=o.length;a<s;a++)if(Z(n,o[a][0]))return o[a][1];return i},or.prototype.update=function(t,e,n,i,o,a,s){for(var u=o===m,f=this.entries,c=0,h=f.length;c<h&&!Z(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===o:u)return this;if(et(s),(u||!p)&&et(a),!(u&&f.length===1)){if(!p&&!u&&f.length>=du)return fu(t,f,i,o);var _=t&&t===this.ownerID,d=_?f:ht(f);return p?u?c===h-1?d.pop():d[c]=d.pop():d[c]=[i,o]:d.push([i,o]),_?(this.entries=d,this):new or(t,d)}};var Ht=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n};Ht.prototype.get=function(t,e,n,i){e===void 0&&(e=V(n));var o=1<<((t===0?e:e>>>t)&F),a=this.bitmap;return(a&o)===0?i:this.nodes[ho(a&o-1)].get(t+O,e,n,i)},Ht.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=V(i));var u=(e===0?n:n>>>e)&F,f=1<<u,c=this.bitmap,h=(c&f)!==0;if(!h&&o===m)return this;var p=ho(c&f-1),_=this.nodes,d=h?_[p]:void 0,v=be(d,t,e+O,n,i,o,a,s);if(v===d)return this;if(!h&&v&&_.length>=lu)return hu(t,_,c,u,v);if(h&&!v&&_.length===2&&co(_[p^1]))return _[p^1];if(h&&v&&_.length===1&&co(v))return v;var w=t&&t===this.ownerID,I=h?v?c:c^f:c|f,y=h?v?po(_,p,v,w):_u(_,p,w):pu(_,p,v,w);return w?(this.bitmap=I,this.nodes=y,this):new Ht(t,I,y)};var ar=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n};ar.prototype.get=function(t,e,n,i){e===void 0&&(e=V(n));var o=(t===0?e:e>>>t)&F,a=this.nodes[o];return a?a.get(t+O,e,n,i):i},ar.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=V(i));var u=(e===0?n:n>>>e)&F,f=o===m,c=this.nodes,h=c[u];if(f&&!h)return this;var p=be(h,t,e+O,n,i,o,a,s);if(p===h)return this;var _=this.count;if(!h)_++;else if(!p&&(_--,_<vu))return cu(t,c,_,u);var d=t&&t===this.ownerID,v=po(c,u,p,d);return d?(this.count=_,this.nodes=v,this):new ar(t,_,v)};var Kt=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n};Kt.prototype.get=function(t,e,n,i){for(var o=this.entries,a=0,s=o.length;a<s;a++)if(Z(n,o[a][0]))return o[a][1];return i},Kt.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=V(i));var u=o===m;if(n!==this.keyHash)return u?this:(et(s),et(a),Ie(this,t,e,n,[i,o]));for(var f=this.entries,c=0,h=f.length;c<h&&!Z(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===o:u)return this;if(et(s),(u||!p)&&et(a),u&&h===2)return new lt(t,this.keyHash,f[c^1]);var _=t&&t===this.ownerID,d=_?f:ht(f);return p?u?c===h-1?d.pop():d[c]=d.pop():d[c]=[i,o]:d.push([i,o]),_?(this.entries=d,this):new Kt(t,this.keyHash,d)};var lt=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n};lt.prototype.get=function(t,e,n,i){return Z(n,this.entry[0])?this.entry[1]:i},lt.prototype.update=function(t,e,n,i,o,a,s){var u=o===m,f=Z(i,this.entry[0]);if(f?o===this.entry[1]:u)return this;if(et(s),u){et(a);return}return f?t&&t===this.ownerID?(this.entry[1]=o,this):new lt(t,this.keyHash,[i,o]):(et(a),Ie(this,t,e,V(i),[i,o]))},or.prototype.iterate=Kt.prototype.iterate=function(r,t){for(var e=this.entries,n=0,i=e.length-1;n<=i;n++)if(r(e[t?i-n:n])===!1)return!1},Ht.prototype.iterate=ar.prototype.iterate=function(r,t){for(var e=this.nodes,n=0,i=e.length-1;n<=i;n++){var o=e[t?i-n:n];if(o&&o.iterate(r,t)===!1)return!1}},lt.prototype.iterate=function(r,t){return r(this.entry)};var uu=(function(r){function t(e,n,i){this._type=n,this._reverse=i,this._stack=e._root&&so(e._root)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.next=function(){for(var n=this._type,i=this._stack;i;){var o=i.node,a=i.index++,s=void 0;if(o.entry){if(a===0)return Se(n,o.entry)}else if(o.entries){if(s=o.entries.length-1,a<=s)return Se(n,o.entries[this._reverse?s-a:a])}else if(s=o.nodes.length-1,a<=s){var u=o.nodes[this._reverse?s-a:a];if(u){if(u.entry)return Se(n,u.entry);i=this._stack=so(u,i)}continue}i=this._stack=this._stack.__prev}return D()},t})(S);function Se(r,t){return A(r,t[0],t[1])}function so(r,t){return{node:r,index:0,__prev:t}}function we(r,t,e,n){var i=Object.create(z);return i.size=r,i._root=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var uo;function pt(){return uo||(uo=we(0))}function fo(r,t,e){var n,i;if(r._root){var o=Yr(),a=Yr();if(n=be(r._root,r.__ownerID,0,void 0,t,e,o,a),!a.value)return r;i=r.size+(o.value?e===m?-1:1:0)}else{if(e===m)return r;i=1,n=new or(r.__ownerID,[[t,e]])}return r.__ownerID?(r.size=i,r._root=n,r.__hash=void 0,r.__altered=!0,r):n?we(i,n):pt()}function be(r,t,e,n,i,o,a,s){return r?r.update(t,e,n,i,o,a,s):o===m?r:(et(s),et(a),new lt(t,n,[i,o]))}function co(r){return r.constructor===lt||r.constructor===Kt}function Ie(r,t,e,n,i){if(r.keyHash===n)return new Kt(t,n,[r.entry,i]);var o=(e===0?r.keyHash:r.keyHash>>>e)&F,a=(e===0?n:n>>>e)&F,s,u=o===a?[Ie(r,t,e+O,n,i)]:(s=new lt(t,n,i),o<a?[r,s]:[s,r]);return new Ht(t,1<<o|1<<a,u)}function fu(r,t,e,n){r||(r=new Jr);for(var i=new lt(r,V(e),[e,n]),o=0;o<t.length;o++){var a=t[o];i=i.update(r,0,void 0,a[0],a[1])}return i}function cu(r,t,e,n){for(var i=0,o=0,a=new Array(e),s=0,u=1,f=t.length;s<f;s++,u<<=1){var c=t[s];c!==void 0&&s!==n&&(i|=u,a[o++]=c)}return new Ht(r,i,a)}function hu(r,t,e,n,i){for(var o=0,a=new Array(X),s=0;e!==0;s++,e>>>=1)a[s]=e&1?t[o++]:void 0;return a[n]=i,new ar(r,o+1,a)}function ho(r){return r-=r>>1&1431655765,r=(r&858993459)+(r>>2&858993459),r=r+(r>>4)&252645135,r+=r>>8,r+=r>>16,r&127}function po(r,t,e,n){var i=n?r:ht(r);return i[t]=e,i}function pu(r,t,e,n){var i=r.length+1;if(n&&t+1===i)return r[t]=e,r;for(var o=new Array(i),a=0,s=0;s<i;s++)s===t?(o[s]=e,a=-1):o[s]=r[s+a];return o}function _u(r,t,e){var n=r.length-1;if(e&&t===n)return r.pop(),r;for(var i=new Array(n),o=0,a=0;a<n;a++)a===t&&(o=1),i[a]=r[a+o];return i}var du=X/4,lu=X/2,vu=X/4;function _o(r){if(ki(r)&&typeof r!="string")return r;if(ft(r))return r.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+r)}function sr(r){try{return typeof r=="string"?JSON.stringify(r):String(r)}catch{return JSON.stringify(r)}}function yu(r,t){return ut(r)?r.has(t):bt(r)&&Nt.call(r,t)}function lo(r,t,e){return ut(r)?r.get(t,e):yu(r,t)?typeof r.get=="function"?r.get(t):r[t]:e}function gu(r,t){if(!bt(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(ut(r)){if(!r.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+r);return r.remove(t)}if(!Nt.call(r,t))return r;var e=Rr(r);return Array.isArray(e)?e.splice(t,1):delete e[t],e}function mu(r,t,e){if(!bt(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(ut(r)){if(!r.set)throw new TypeError("Cannot update immutable value without .set() method: "+r);return r.set(t,e)}if(Nt.call(r,t)&&e===r[t])return r;var n=Rr(r);return n[t]=e,n}function Wt(r,t,e,n){n||(n=e,e=void 0);var i=vo(ut(r),r,_o(t),0,e,n);return i===m?e:i}function vo(r,t,e,n,i,o){var a=t===m;if(n===e.length){var s=a?i:t,u=o(s);return u===s?t:u}if(!a&&!bt(t))throw new TypeError("Cannot update within non-data-structure value in path ["+Array.from(e).slice(0,n).map(sr)+"]: "+t);var f=e[n],c=a?m:lo(t,f,m),h=vo(c===m?r:ut(c),c,e,n+1,i,o);return h===c?t:h===m?gu(t,f):mu(a?r?pt():{}:t,f,h)}function Su(r,t){return Wt(r,t,function(){return m})}function qe(r){return Su(this,r)}var yo="@@__IMMUTABLE_LIST__@@";function go(r){return!!(r&&r[yo])}var zr=(function(r){function t(e){var n=Cr();if(e==null)return n;if(go(e))return e;var i=r(e),o=i.size;return o===0?n:(Q(o),o>0&&o<X?fr(0,o,O,null,new It(i.toArray())):n.withMutations(function(a){a.setSize(o),i.forEach(function(s,u){return a.set(u,s)})}))}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("List [","]")},t.prototype.get=function(n,i){if(n=mt(this,n),n>=0&&n<this.size){n+=this._origin;var o=So(this,n);return o&&o.array[n&F]}return i},t.prototype.set=function(n,i){return wu(this,n,i)},t.prototype.remove=function(n){return this.has(n)?n===0?this.shift():n===this.size-1?this.pop():this.splice(n,1):this},t.prototype.insert=function(n,i){return this.splice(n,0,i)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=O,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):Cr()},t.prototype.push=function(){var n=arguments,i=this.size;return this.withMutations(function(o){qt(o,0,i+n.length);for(var a=0;a<n.length;a++)o.set(i+a,n[a])})},t.prototype.pop=function(){return qt(this,0,-1)},t.prototype.unshift=function(){var n=arguments;return this.withMutations(function(i){qt(i,-n.length);for(var o=0;o<n.length;o++)i.set(o,n[o])})},t.prototype.shift=function(){return qt(this,1)},t.prototype.shuffle=function(n){return n===void 0&&(n=Math.random),this.withMutations(function(i){for(var o=i.size,a,s;o;)a=Math.floor(n()*o--),s=i.get(a),i.set(a,i.get(o)),i.set(o,s)})},t.prototype.concat=function(){for(var n=arguments,i=[],o=0;o<arguments.length;o++){var a=n[o],s=r(typeof a!="string"&&Ei(a)?a:[a]);s.size!==0&&i.push(s)}return i.length===0?this:this.size===0&&!this.__ownerID&&i.length===1?this.constructor(i[0]):this.withMutations(function(u){i.forEach(function(f){return f.forEach(function(c){return u.push(c)})})})},t.prototype.setSize=function(n){return qt(this,0,n)},t.prototype.map=function(n,i){var o=this;return this.withMutations(function(a){for(var s=0;s<o.size;s++)a.set(s,n.call(i,a.get(s),s,o))})},t.prototype.slice=function(n,i){var o=this.size;return Ir(n,i,o)?this:qt(this,Qt(n,o),qr(i,o))},t.prototype.__iterator=function(n,i){var o=i?this.size:0,a=mo(this,i);return new S(function(){var s=a();return s===ur?D():A(n,i?--o:o++,s)})},t.prototype.__iterate=function(n,i){for(var o=i?this.size:0,a=mo(this,i),s;(s=a())!==ur&&n(s,i?--o:o++,this)!==!1;);return o},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?fr(this._origin,this._capacity,this._level,this._root,this._tail,n,this.__hash):this.size===0?Cr():(this.__ownerID=n,this.__altered=!1,this)},t})(Ct);zr.isList=go;var x=zr.prototype;x[yo]=!0,x[Zt]=x.remove,x.merge=x.concat,x.setIn=le,x.deleteIn=x.removeIn=qe,x.update=ve,x.updateIn=ye,x.mergeIn=de,x.mergeDeepIn=_e,x.withMutations=nr,x.wasAltered=ge,x.asImmutable=tr,x["@@transducer/init"]=x.asMutable=rr,x["@@transducer/step"]=function(r,t){return r.push(t)},x["@@transducer/result"]=function(r){return r.asImmutable()};var It=function(t,e){this.array=t,this.ownerID=e};It.prototype.removeBefore=function(t,e,n){if((n&(1<<e+O)-1)===0||this.array.length===0)return this;var i=n>>>e&F;if(i>=this.array.length)return new It([],t);var o=i===0,a;if(e>0){var s=this.array[i];if(a=s&&s.removeBefore(t,e-O,n),a===s&&o)return this}if(o&&!a)return this;var u=Gt(this,t);if(!o)for(var f=0;f<i;f++)u.array[f]=void 0;return a&&(u.array[i]=a),u},It.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e+O:X)||this.array.length===0)return this;var i=n-1>>>e&F;if(i>=this.array.length)return this;var o;if(e>0){var a=this.array[i];if(o=a&&a.removeAfter(t,e-O,n),o===a&&i===this.array.length-1)return this}var s=Gt(this,t);return s.array.splice(i+1),o&&(s.array[i]=o),s};var ur={};function mo(r,t){var e=r._origin,n=r._capacity,i=cr(n),o=r._tail;return a(r._root,r._level,0);function a(f,c,h){return c===0?s(f,h):u(f,c,h)}function s(f,c){var h=c===i?o&&o.array:f&&f.array,p=c>e?0:e-c,_=n-c;return _>X&&(_=X),function(){if(p===_)return ur;var d=t?--_:p++;return h&&h[d]}}function u(f,c,h){var p,_=f&&f.array,d=h>e?0:e-h>>c,v=(n-h>>c)+1;return v>X&&(v=X),function(){for(;;){if(p){var w=p();if(w!==ur)return w;p=null}if(d===v)return ur;var I=t?--v:d++;p=a(_&&_[I],c-O,h+(I<<c))}}}}function fr(r,t,e,n,i,o,a){var s=Object.create(x);return s.size=t-r,s._origin=r,s._capacity=t,s._level=e,s._root=n,s._tail=i,s.__ownerID=o,s.__hash=a,s.__altered=!1,s}function Cr(){return fr(0,0,O)}function wu(r,t,e){if(t=mt(r,t),t!==t)return r;if(t>=r.size||t<0)return r.withMutations(function(a){t<0?qt(a,t).set(0,e):qt(a,0,t+1).set(t,e)});t+=r._origin;var n=r._tail,i=r._root,o=Yr();return t>=cr(r._capacity)?n=Me(n,r.__ownerID,0,t,e,o):i=Me(i,r.__ownerID,r._level,t,e,o),o.value?r.__ownerID?(r._root=i,r._tail=n,r.__hash=void 0,r.__altered=!0,r):fr(r._origin,r._capacity,r._level,i,n):r}function Me(r,t,e,n,i,o){var a=n>>>e&F,s=r&&a<r.array.length;if(!s&&i===void 0)return r;var u;if(e>0){var f=r&&r.array[a],c=Me(f,t,e-O,n,i,o);return c===f?r:(u=Gt(r,t),u.array[a]=c,u)}return s&&r.array[a]===i?r:(o&&et(o),u=Gt(r,t),i===void 0&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Gt(r,t){return t&&r&&t===r.ownerID?r:new It(r?r.array.slice():[],t)}function So(r,t){if(t>=cr(r._capacity))return r._tail;if(t<1<<r._level+O){for(var e=r._root,n=r._level;e&&n>0;)e=e.array[t>>>n&F],n-=O;return e}}function qt(r,t,e){t!==void 0&&(t|=0),e!==void 0&&(e|=0);var n=r.__ownerID||new Jr,i=r._origin,o=r._capacity,a=i+t,s=e===void 0?o:e<0?o+e:i+e;if(a===i&&s===o)return r;if(a>=s)return r.clear();for(var u=r._level,f=r._root,c=0;a+c<0;)f=new It(f&&f.array.length?[void 0,f]:[],n),u+=O,c+=1<<u;c&&(a+=c,i+=c,s+=c,o+=c);for(var h=cr(o),p=cr(s);p>=1<<u+O;)f=new It(f&&f.array.length?[f]:[],n),u+=O;var _=r._tail,d=p<h?So(r,s-1):p>h?new It([],n):_;if(_&&p>h&&a<o&&_.array.length){f=Gt(f,n);for(var v=f,w=u;w>O;w-=O){var I=h>>>w&F;v=v.array[I]=Gt(v.array[I],n)}v.array[h>>>O&F]=_}if(s<o&&(d=d&&d.removeAfter(n,0,s)),a>=p)a-=p,s-=p,u=O,f=null,d=d&&d.removeBefore(n,0,a);else if(a>i||p<h){for(c=0;f;){var y=a>>>u&F;if(y!==p>>>u&F)break;y&&(c+=(1<<u)*y),u-=O,f=f.array[y]}f&&a>i&&(f=f.removeBefore(n,u,a-c)),f&&p<h&&(f=f.removeAfter(n,u,p-c)),c&&(a-=c,s-=c)}return r.__ownerID?(r.size=s-a,r._origin=a,r._capacity=s,r._level=u,r._root=f,r._tail=d,r.__hash=void 0,r.__altered=!0,r):fr(a,s,u,f,d)}function cr(r){return r<X?0:r-1>>>O<<O}function wo(r){return me(r)&&ft(r)}var vt=(function(r){function t(e){return e==null?hr():wo(e)?e:hr().withMutations(function(n){var i=rt(e);Q(i.size),i.forEach(function(o,a){return n.set(a,o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(n,i){var o=this._map.get(n);return o!==void 0?this._list.get(o)[1]:i},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):hr()},t.prototype.set=function(n,i){return Io(this,n,i)},t.prototype.remove=function(n){return Io(this,n,m)},t.prototype.__iterate=function(n,i){var o=this;return this._list.__iterate(function(a){return a&&n(a[1],a[0],o)},i)},t.prototype.__iterator=function(n,i){return this._list.fromEntrySeq().__iterator(n,i)},t.prototype.__ensureOwner=function(n){if(n===this.__ownerID)return this;var i=this._map.__ensureOwner(n),o=this._list.__ensureOwner(n);return n?Oe(i,o,n,this.__hash):this.size===0?hr():(this.__ownerID=n,this.__altered=!1,this._map=i,this._list=o,this)},t})(j);vt.isOrderedMap=wo,vt.prototype[St]=!0,vt.prototype[Zt]=vt.prototype.remove;function Oe(r,t,e,n){var i=Object.create(vt.prototype);return i.size=r?r.size:0,i._map=r,i._list=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var bo;function hr(){return bo||(bo=Oe(pt(),Cr()))}function Io(r,t,e){var n=r._map,i=r._list,o=n.get(t),a=o!==void 0,s,u;if(e===m){if(!a)return r;i.size>=X&&i.size>=n.size*2?(u=i.filter(function(f,c){return f!==void 0&&o!==c}),s=u.toKeyedSeq().map(function(f){return f[0]}).flip().toMap(),r.__ownerID&&(s.__ownerID=u.__ownerID=r.__ownerID)):(s=n.remove(t),u=o===i.size-1?i.pop():i.set(o,void 0))}else if(a){if(e===i.get(o)[1])return r;s=n,u=i.set(o,[t,e])}else s=n.set(t,i.size),u=i.set(i.size,[t,e]);return r.__ownerID?(r.size=s.size,r._map=s,r._list=u,r.__hash=void 0,r.__altered=!0,r):Oe(s,u)}var qo="@@__IMMUTABLE_STACK__@@";function Ee(r){return!!(r&&r[qo])}var Te=(function(r){function t(e){return e==null?Ar():Ee(e)?e:Ar().pushAll(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(n,i){var o=this._head;for(n=mt(this,n);o&&n--;)o=o.next;return o?o.value:i},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var n=arguments;if(arguments.length===0)return this;for(var i=this.size+arguments.length,o=this._head,a=arguments.length-1;a>=0;a--)o={value:n[a],next:o};return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):pr(i,o)},t.prototype.pushAll=function(n){if(n=r(n),n.size===0)return this;if(this.size===0&&Ee(n))return n;Q(n.size);var i=this.size,o=this._head;return n.__iterate(function(a){i++,o={value:a,next:o}},!0),this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):pr(i,o)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return this.size===0?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Ar()},t.prototype.slice=function(n,i){if(Ir(n,i,this.size))return this;var o=Qt(n,this.size),a=qr(i,this.size);if(a!==this.size)return r.prototype.slice.call(this,n,i);for(var s=this.size-o,u=this._head;o--;)u=u.next;return this.__ownerID?(this.size=s,this._head=u,this.__hash=void 0,this.__altered=!0,this):pr(s,u)},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?pr(this.size,this._head,n,this.__hash):this.size===0?Ar():(this.__ownerID=n,this.__altered=!1,this)},t.prototype.__iterate=function(n,i){var o=this;if(i)return new Ft(this.toArray()).__iterate(function(u,f){return n(u,f,o)},i);for(var a=0,s=this._head;s&&n(s.value,a++,this)!==!1;)s=s.next;return a},t.prototype.__iterator=function(n,i){if(i)return new Ft(this.toArray()).__iterator(n,i);var o=0,a=this._head;return new S(function(){if(a){var s=a.value;return a=a.next,A(n,o++,s)}return D()})},t})(Ct);Te.isStack=Ee;var U=Te.prototype;U[qo]=!0,U.shift=U.pop,U.unshift=U.push,U.unshiftAll=U.pushAll,U.withMutations=nr,U.wasAltered=ge,U.asImmutable=tr,U["@@transducer/init"]=U.asMutable=rr,U["@@transducer/step"]=function(r,t){return r.unshift(t)},U["@@transducer/result"]=function(r){return r.asImmutable()};function pr(r,t,e,n){var i=Object.create(U);return i.size=r,i._head=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var Mo;function Ar(){return Mo||(Mo=pr(0))}function Oo(r,t,e,n,i,o){return Q(r.size),r.__iterate(function(a,s,u){i?(i=!1,e=a):e=t.call(n,e,a,s,u)},o),e}function bu(r,t){return t}function Iu(r,t){return[t,r]}function Re(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return!r.apply(this,t)}}function Eo(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return-r.apply(this,t)}}function To(r,t){return r<t?1:r>t?-1:0}function Ro(r,t){if(r===t)return!0;if(!G(t)||r.size!==void 0&&t.size!==void 0&&r.size!==t.size||r.__hash!==void 0&&t.__hash!==void 0&&r.__hash!==t.__hash||C(r)!==C(t)||tt(r)!==tt(t)||ft(r)!==ft(t))return!1;if(r.size===0&&t.size===0)return!0;var e=!Kr(r);if(ft(r)){var n=r.entries();return t.every(function(u,f){var c=n.next().value;return c&&Z(c[1],u)&&(e||Z(c[0],f))})&&n.next().done}var i=!1;if(r.size===void 0)if(t.size===void 0)typeof r.cacheResult=="function"&&r.cacheResult();else{i=!0;var o=r;r=t,t=o}var a=!0,s=t.__iterate(function(u,f){if(e?!r.has(u):i?!Z(u,r.get(f,m)):!Z(r.get(f,m),u))return a=!1,!1});return a&&r.size===s}var qu=(function(r){function t(e,n,i){if(i===void 0&&(i=1),!(this instanceof t))return new t(e,n,i);if(ir(i!==0,"Cannot step a Range by 0"),ir(e!==void 0,"You must define a start value when using Range"),ir(n!==void 0,"You must define an end value when using Range"),i=Math.abs(i),n<e&&(i=-i),this._start=e,this._end=n,this._step=i,this.size=Math.max(0,Math.ceil((n-e)/i-1)+1),this.size===0){if(ze)return ze;ze=this}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.size===0?"Range []":"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"},t.prototype.get=function(n,i){return this.has(n)?this._start+mt(this,n)*this._step:i},t.prototype.includes=function(n){var i=(n-this._start)/this._step;return i>=0&&i<this.size&&i===Math.floor(i)},t.prototype.slice=function(n,i){return Ir(n,i,this.size)?this:(n=Qt(n,this.size),i=qr(i,this.size),i<=n?new t(0,0):new t(this.get(n,this._end),this.get(i,this._end),this._step))},t.prototype.indexOf=function(n){var i=n-this._start;if(i%this._step===0){var o=i/this._step;if(o>=0&&o<this.size)return o}return-1},t.prototype.lastIndexOf=function(n){return this.indexOf(n)},t.prototype.__iterate=function(n,i){for(var o=this.size,a=this._step,s=i?this._start+(o-1)*a:this._start,u=0;u!==o&&n(s,i?o-++u:u++,this)!==!1;)s+=i?-a:a;return u},t.prototype.__iterator=function(n,i){var o=this.size,a=this._step,s=i?this._start+(o-1)*a:this._start,u=0;return new S(function(){if(u===o)return D();var f=s;return s+=i?-a:a,A(n,i?o-++u:u++,f)})},t.prototype.equals=function(n){return n instanceof t?this._start===n._start&&this._end===n._end&&this._step===n._step:Ro(this,n)},t})(it),ze,zo="@@__IMMUTABLE_SET__@@";function Ce(r){return!!(r&&r[zo])}var _t=(function(r){function t(e){return e==null?_r():Ce(e)&&!ft(e)?e:_r().withMutations(function(n){var i=r(e);Q(i.size),i.forEach(function(o){return n.add(o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(n){return this(rt(n).keySeq())},t.intersect=function(n){return n=P(n).toArray(),n.length?L.intersect.apply(t(n.pop()),n):_r()},t.union=function(n){return n=P(n).toArray(),n.length?L.union.apply(t(n.pop()),n):_r()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(n){return this._map.has(n)},t.prototype.add=function(n){return $r(this,this._map.set(n,n))},t.prototype.remove=function(n){return $r(this,this._map.remove(n))},t.prototype.clear=function(){return $r(this,this._map.clear())},t.prototype.map=function(n,i){var o=this,a=!1,s=$r(this,this._map.mapEntries(function(u){var f=u[1],c=n.call(i,f,f,o);return c!==f&&(a=!0),[c,c]},i));return a?s:this},t.prototype.union=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return n=n.filter(function(o){return o.size!==0}),n.length===0?this:this.size===0&&!this.__ownerID&&n.length===1?this.constructor(n[0]):this.withMutations(function(o){for(var a=0;a<n.length;a++)typeof n[a]=="string"?o.add(n[a]):r(n[a]).forEach(function(s){return o.add(s)})})},t.prototype.intersect=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(n.length===0)return this;n=n.map(function(a){return r(a)});var o=[];return this.forEach(function(a){n.every(function(s){return s.includes(a)})||o.push(a)}),this.withMutations(function(a){o.forEach(function(s){a.remove(s)})})},t.prototype.subtract=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(n.length===0)return this;n=n.map(function(a){return r(a)});var o=[];return this.forEach(function(a){n.some(function(s){return s.includes(a)})&&o.push(a)}),this.withMutations(function(a){o.forEach(function(s){a.remove(s)})})},t.prototype.sort=function(n){return lr(Ut(this,n))},t.prototype.sortBy=function(n,i){return lr(Ut(this,i,n))},t.prototype.wasAltered=function(){return this._map.wasAltered()},t.prototype.__iterate=function(n,i){var o=this;return this._map.__iterate(function(a){return n(a,a,o)},i)},t.prototype.__iterator=function(n,i){return this._map.__iterator(n,i)},t.prototype.__ensureOwner=function(n){if(n===this.__ownerID)return this;var i=this._map.__ensureOwner(n);return n?this.__make(i,n):this.size===0?this.__empty():(this.__ownerID=n,this._map=i,this)},t})(xt);_t.isSet=Ce;var L=_t.prototype;L[zo]=!0,L[Zt]=L.remove,L.merge=L.concat=L.union,L.withMutations=nr,L.asImmutable=tr,L["@@transducer/init"]=L.asMutable=rr,L["@@transducer/step"]=function(r,t){return r.add(t)},L["@@transducer/result"]=function(r){return r.asImmutable()},L.__empty=_r,L.__make=Co;function $r(r,t){return r.__ownerID?(r.size=t.size,r._map=t,r):t===r._map?r:t.size===0?r.__empty():r.__make(t)}function Co(r,t){var e=Object.create(L);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var Ao;function _r(){return Ao||(Ao=Co(pt()))}function $o(r,t,e){for(var n=_o(t),i=0;i!==n.length;)if(r=lo(r,n[i++],m),r===m)return e;return r}function ko(r,t){return $o(this,r,t)}function Mu(r,t){return $o(r,t,m)!==m}function Ou(r){return Mu(this,r)}function Bo(){Q(this.size);var r={};return this.__iterate(function(t,e){r[e]=t}),r}function kr(r){if(!r||typeof r!="object")return r;if(!G(r)){if(!bt(r))return r;r=K(r)}if(C(r)){var t={};return r.__iterate(function(n,i){t[i]=kr(n)}),t}var e=[];return r.__iterate(function(n){e.push(kr(n))}),e}function Eu(r){if(r.size===1/0)return 0;var t=ft(r),e=C(r),n=t?1:0;return r.__iterate(e?t?function(i,o){n=31*n+jo(V(i),V(o))|0}:function(i,o){n=n+jo(V(i),V(o))|0}:t?function(i){n=31*n+V(i)|0}:function(i){n=n+V(i)|0}),Tu(r.size,n)}function Tu(r,t){return t=er(t,3432918353),t=er(t<<15|t>>>-15,461845907),t=er(t<<13|t>>>-13,5),t=(t+3864292196|0)^r,t=er(t^t>>>16,2246822507),t=er(t^t>>>13,3266489909),t=Mr(t^t>>>16),t}function jo(r,t){return r^t+2654435769+(r<<6)+(r>>2)|0}function kt(r,t){var e=function(n){r.prototype[n]=t[n]};return Object.keys(t).forEach(e),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(e),r}P.Iterator=S,kt(P,{toArray:function(){Q(this.size);var t=new Array(this.size||0),e=C(this),n=0;return this.__iterate(function(i,o){t[n++]=e?[o,i]:i}),t},toIndexedSeq:function(){return new Fi(this)},toJS:function(){return kr(this)},toKeyedSeq:function(){return new Or(this,!0)},toMap:function(){return j(this.toKeyedSeq())},toObject:Bo,toOrderedMap:function(){return vt(this.toKeyedSeq())},toOrderedSet:function(){return lr(C(this)?this.valueSeq():this)},toSet:function(){return _t(C(this)?this.valueSeq():this)},toSetSeq:function(){return new Ui(this)},toSeq:function(){return tt(this)?this.toIndexedSeq():C(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Te(C(this)?this.valueSeq():this)},toList:function(){return zr(C(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(t,e){return this.size===0?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return E(this,tu(this,t))},includes:function(t){return this.some(function(e){return Z(e,t)})},entries:function(){return this.__iterator(J)},every:function(t,e){Q(this.size);var n=!0;return this.__iterate(function(i,o,a){if(!t.call(e,i,o,a))return n=!1,!1}),n},filter:function(t,e){return E(this,Gi(this,t,e,!0))},partition:function(t,e){return Vs(this,t,e)},find:function(t,e,n){var i=this.findEntry(t,e);return i?i[1]:n},forEach:function(t,e){return Q(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){Q(this.size),t=t!==void 0?""+t:",";var e="",n=!0;return this.__iterate(function(i){n?n=!1:e+=t,e+=i!=null?i.toString():""}),e},keys:function(){return this.__iterator(Lt)},map:function(t,e){return E(this,Wi(this,t,e))},reduce:function(t,e,n){return Oo(this,t,e,n,arguments.length<2,!1)},reduceRight:function(t,e,n){return Oo(this,t,e,n,arguments.length<2,!0)},reverse:function(){return E(this,se(this,!0))},slice:function(t,e){return E(this,ue(this,t,e,!0))},some:function(t,e){Q(this.size);var n=!1;return this.__iterate(function(i,o,a){if(t.call(e,i,o,a))return n=!0,!1}),n},sort:function(t){return E(this,Ut(this,t))},values:function(){return this.__iterator(Y)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==void 0?this.size===0:!this.some(function(){return!0})},count:function(t,e){return Pt(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return Js(this,t,e)},equals:function(t){return Ro(this,t)},entrySeq:function(){var t=this;if(t._cache)return new Ft(t._cache);var e=t.toSeq().map(Iu).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Re(t),e)},findEntry:function(t,e,n){var i=n;return this.__iterate(function(o,a,s){if(t.call(e,o,a,s))return i=[a,o],!1}),i},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastEntry:function(t,e,n){return this.toKeyedSeq().reverse().findEntry(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(t){return this.find(Ri,null,t)},flatMap:function(t,e){return E(this,ru(this,t,e))},flatten:function(t){return E(this,Ji(this,t,!0))},fromEntrySeq:function(){return new Hi(this)},get:function(t,e){return this.find(function(n,i){return Z(i,t)},void 0,e)},getIn:ko,groupBy:function(t,e){return Xs(this,t,e)},has:function(t){return this.get(t,m)!==m},hasIn:Ou,isSubset:function(t){return t=typeof t.includes=="function"?t:P(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t=typeof t.isSubset=="function"?t:P(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return Z(e,t)})},keySeq:function(){return this.toSeq().map(bu).toIndexedSeq()},last:function(t){return this.toSeq().reverse().first(t)},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return Er(this,t)},maxBy:function(t,e){return Er(this,e,t)},min:function(t){return Er(this,t?Eo(t):To)},minBy:function(t,e){return Er(this,e?Eo(e):To,t)},rest:function(){return this.slice(1)},skip:function(t){return t===0?this:this.slice(Math.max(0,t))},skipLast:function(t){return t===0?this:this.slice(0,-Math.max(0,t))},skipWhile:function(t,e){return E(this,Yi(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Re(t),e)},sortBy:function(t,e){return E(this,Ut(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return this.slice(-Math.max(0,t))},takeWhile:function(t,e){return E(this,Zs(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Re(t),e)},update:function(t){return t(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=Eu(this))}});var N=P.prototype;N[Mi]=!0,N[wr]=N.values,N.toJSON=N.toArray,N.__toStringMapper=sr,N.inspect=N.toSource=function(){return this.toString()},N.chain=N.flatMap,N.contains=N.includes,kt(rt,{flip:function(){return E(this,Ki(this))},mapEntries:function(t,e){var n=this,i=0;return E(this,this.toSeq().map(function(o,a){return t.call(e,[a,o],i++,n)}).fromEntrySeq())},mapKeys:function(t,e){var n=this;return E(this,this.toSeq().flip().map(function(i,o){return t.call(e,i,o,n)}).flip())}});var dr=rt.prototype;dr[Sr]=!0,dr[wr]=N.entries,dr.toJSON=Bo,dr.__toStringMapper=function(r,t){return sr(t)+": "+sr(r)},kt(Ct,{toKeyedSeq:function(){return new Or(this,!1)},filter:function(t,e){return E(this,Gi(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.keyOf(t);return e===void 0?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return e===void 0?-1:e},reverse:function(){return E(this,se(this,!1))},slice:function(t,e){return E(this,ue(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(e||0,0),n===0||n===2&&!e)return this;t=Qt(t,t<0?this.count():this.size);var i=this.slice(0,t);return E(this,n===1?i:i.concat(ht(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.findLastEntry(t,e);return n?n[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return E(this,Ji(this,t,!1))},get:function(t,e){return t=mt(this,t),t<0||this.size===1/0||this.size!==void 0&&t>this.size?e:this.find(function(n,i){return i===t},void 0,e)},has:function(t){return t=mt(this,t),t>=0&&(this.size!==void 0?this.size===1/0||t<this.size:this.indexOf(t)!==-1)},interpose:function(t){return E(this,eu(this,t))},interleave:function(){var t=[this].concat(ht(arguments)),e=Tr(this.toSeq(),it.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),E(this,n)},keySeq:function(){return qu(0,this.size)},last:function(t){return this.get(-1,t)},skipWhile:function(t,e){return E(this,Yi(this,t,e,!1))},zip:function(){var t=[this].concat(ht(arguments));return E(this,Tr(this,xo,t))},zipAll:function(){var t=[this].concat(ht(arguments));return E(this,Tr(this,xo,t,!0))},zipWith:function(t){var e=ht(arguments);return e[0]=this,E(this,Tr(this,t,e))}});var Yt=Ct.prototype;Yt[gt]=!0,Yt[St]=!0,kt(xt,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}});var Jt=xt.prototype;Jt.has=N.includes,Jt.contains=Jt.includes,Jt.keys=Jt.values,kt(wt,dr),kt(it,Yt),kt(Dt,Jt);function xo(){return ht(arguments)}function Lo(r){return Ce(r)&&ft(r)}var lr=(function(r){function t(e){return e==null?Ae():Lo(e)?e:Ae().withMutations(function(n){var i=xt(e);Q(i.size),i.forEach(function(o){return n.add(o)})})}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(n){return this(rt(n).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t})(_t);lr.isOrderedSet=Lo;var Bt=lr.prototype;Bt[St]=!0,Bt.zip=Yt.zip,Bt.zipWith=Yt.zipWith,Bt.zipAll=Yt.zipAll,Bt.__empty=Ae,Bt.__make=Po;function Po(r,t){var e=Object.create(Bt);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var No;function Ae(){return No||(No=Po(hr()))}function Ru(r){if(At(r))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(ut(r))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(r===null||typeof r!="object")throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}var k=function(t,e){var n;Ru(t);var i=function(s){var u=this;if(s instanceof i)return s;if(!(this instanceof i))return new i(s);if(!n){n=!0;var f=Object.keys(t),c=o._indices={};o._name=e,o._keys=f,o._defaultValues=t;for(var h=0;h<f.length;h++){var p=f[h];c[p]=h,o[p]?typeof console=="object"&&console.warn&&console.warn("Cannot define "+ke(this)+' with property "'+p+'" since that property name is part of the Record API.'):zu(o,p)}}return this.__ownerID=void 0,this._values=zr().withMutations(function(_){_.setSize(u._keys.length),rt(s).forEach(function(d,v){_.set(u._indices[v],d===u._defaultValues[v]?void 0:d)})}),this},o=i.prototype=Object.create(T);return o.constructor=i,e&&(i.displayName=e),i};k.prototype.toString=function(){for(var t=ke(this)+" { ",e=this._keys,n,i=0,o=e.length;i!==o;i++)n=e[i],t+=(i?", ":"")+n+": "+sr(this.get(n));return t+" }"},k.prototype.equals=function(t){return this===t||At(t)&&Xt(this).equals(Xt(t))},k.prototype.hashCode=function(){return Xt(this).hashCode()},k.prototype.has=function(t){return this._indices.hasOwnProperty(t)},k.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._indices[t],i=this._values.get(n);return i===void 0?this._defaultValues[t]:i},k.prototype.set=function(t,e){if(this.has(t)){var n=this._values.set(this._indices[t],e===this._defaultValues[t]?void 0:e);if(n!==this._values&&!this.__ownerID)return $e(this,n)}return this},k.prototype.remove=function(t){return this.set(t)},k.prototype.clear=function(){var t=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:$e(this,t)},k.prototype.wasAltered=function(){return this._values.wasAltered()},k.prototype.toSeq=function(){return Xt(this)},k.prototype.toJS=function(){return kr(this)},k.prototype.entries=function(){return this.__iterator(J)},k.prototype.__iterator=function(t,e){return Xt(this).__iterator(t,e)},k.prototype.__iterate=function(t,e){return Xt(this).__iterate(t,e)},k.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._values.__ensureOwner(t);return t?$e(this,e,t):(this.__ownerID=t,this._values=e,this)},k.isRecord=At,k.getDescriptiveName=ke;var T=k.prototype;T[Ai]=!0,T[Zt]=T.remove,T.deleteIn=T.removeIn=qe,T.getIn=ko,T.hasIn=N.hasIn,T.merge=ro,T.mergeWith=eo,T.mergeIn=de,T.mergeDeep=io,T.mergeDeepWith=oo,T.mergeDeepIn=_e,T.setIn=le,T.update=ve,T.updateIn=ye,T.withMutations=nr,T.asMutable=rr,T.asImmutable=tr,T[wr]=T.entries,T.toJSON=T.toObject=N.toObject,T.inspect=T.toSource=function(){return this.toString()};function $e(r,t,e){var n=Object.create(Object.getPrototypeOf(r));return n._values=t,n.__ownerID=e,n}function ke(r){return r.constructor.displayName||r.constructor.name||"Record"}function Xt(r){return Qr(r._keys.map(function(t){return[t,r.get(t)]}))}function zu(r,t){try{Object.defineProperty(r,t,{get:function(){return this.get(t)},set:function(e){ir(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch{}}var Br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Be,Do;function Fo(){if(Do)return Be;Do=1;function r(t,e){for(var n=-1,i=e.length,o=t.length;++n<i;)t[o+n]=e[n];return t}return Be=r,Be}var je,Uo;function Au(){if(Uo)return je;Uo=1;var r=typeof Br=="object"&&Br&&Br.Object===Object&&Br;return je=r,je}var xe,Ho;function Le(){if(Ho)return xe;Ho=1;var r=Au(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return xe=e,xe}var Pe,Ko;function jr(){if(Ko)return Pe;Ko=1;var r=Le(),t=r.Symbol;return Pe=t,Pe}var Ne,Wo;function $u(){if(Wo)return Ne;Wo=1;var r=jr(),t=Object.prototype,e=t.hasOwnProperty,n=t.toString,i=r?r.toStringTag:void 0;function o(a){var s=e.call(a,i),u=a[i];try{a[i]=void 0;var f=!0}catch{}var c=n.call(a);return f&&(s?a[i]=u:delete a[i]),c}return Ne=o,Ne}var De,Go;function ku(){if(Go)return De;Go=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return De=e,De}var Fe,Yo;function xr(){if(Yo)return Fe;Yo=1;var r=jr(),t=$u(),e=ku(),n="[object Null]",i="[object Undefined]",o=r?r.toStringTag:void 0;function a(s){return s==null?s===void 0?i:n:o&&o in Object(s)?t(s):e(s)}return Fe=a,Fe}var Ue,Jo;function Lr(){if(Jo)return Ue;Jo=1;function r(t){return t!=null&&typeof t=="object"}return Ue=r,Ue}var He,Xo;function Bu(){if(Xo)return He;Xo=1;var r=xr(),t=Lr(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return He=n,He}var Ke,Vo;function Zo(){if(Vo)return Ke;Vo=1;var r=Bu(),t=Lr(),e=Object.prototype,n=e.hasOwnProperty,i=e.propertyIsEnumerable,o=r((function(){return arguments})())?r:function(a){return t(a)&&n.call(a,"callee")&&!i.call(a,"callee")};return Ke=o,Ke}var We,Qo;function Mt(){if(Qo)return We;Qo=1;var r=Array.isArray;return We=r,We}var Ge,ta;function ju(){if(ta)return Ge;ta=1;var r=jr(),t=Zo(),e=Mt(),n=r?r.isConcatSpreadable:void 0;function i(o){return e(o)||t(o)||!!(n&&o&&o[n])}return Ge=i,Ge}var Ye,ra;function xu(){if(ra)return Ye;ra=1;var r=Fo(),t=ju();function e(n,i,o,a,s){var u=-1,f=n.length;for(o||(o=t),s||(s=[]);++u<f;){var c=n[u];i>0&&o(c)?i>1?e(c,i-1,o,a,s):r(s,c):a||(s[s.length]=c)}return s}return Ye=e,Ye}var Je,ea;function Lu(){if(ea)return Je;ea=1;function r(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}return Je=r,Je}var Xe,na;function Pu(){if(na)return Xe;na=1;var r=Fo(),t=xu(),e=Lu(),n=Mt();function i(){var o=arguments.length;if(!o)return[];for(var a=Array(o-1),s=arguments[0],u=o;u--;)a[u-1]=arguments[u];return r(n(s)?e(s):[s],t(a,1))}return Xe=i,Xe}Pu();var Ve,ia;function Nu(){if(ia)return Ve;ia=1;function r(t,e){return t!=null&&e in Object(t)}return Ve=r,Ve}var Ze,oa;function Pr(){if(oa)return Ze;oa=1;var r=xr(),t=Lr(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return Ze=n,Ze}var Qe,aa;function Du(){if(aa)return Qe;aa=1;var r=Mt(),t=Pr(),e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(o,a){if(r(o))return!1;var s=typeof o;return s=="number"||s=="symbol"||s=="boolean"||o==null||t(o)?!0:n.test(o)||!e.test(o)||a!=null&&o in Object(a)}return Qe=i,Qe}var tn,sa;function rn(){if(sa)return tn;sa=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return tn=r,tn}var en,ua;function Fu(){if(ua)return en;ua=1;var r=xr(),t=rn(),e="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function a(s){if(!t(s))return!1;var u=r(s);return u==n||u==i||u==e||u==o}return en=a,en}var nn,fa;function Uu(){if(fa)return nn;fa=1;var r=Le(),t=r["__core-js_shared__"];return nn=t,nn}var on,ca;function Hu(){if(ca)return on;ca=1;var r=Uu(),t=(function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function e(n){return!!t&&t in n}return on=e,on}var an,ha;function Ku(){if(ha)return an;ha=1;var r=Function.prototype,t=r.toString;function e(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return an=e,an}var sn,pa;function Wu(){if(pa)return sn;pa=1;var r=Fu(),t=Hu(),e=rn(),n=Ku(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,a=Function.prototype,s=Object.prototype,u=a.toString,f=s.hasOwnProperty,c=RegExp("^"+u.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(p){if(!e(p)||t(p))return!1;var _=r(p)?c:o;return _.test(n(p))}return sn=h,sn}var un,_a;function Gu(){if(_a)return un;_a=1;function r(t,e){return t?.[e]}return un=r,un}var fn,da;function la(){if(da)return fn;da=1;var r=Wu(),t=Gu();function e(n,i){var o=t(n,i);return r(o)?o:void 0}return fn=e,fn}var cn,va;function Nr(){if(va)return cn;va=1;var r=la(),t=r(Object,"create");return cn=t,cn}var hn,ya;function Yu(){if(ya)return hn;ya=1;var r=Nr();function t(){this.__data__=r?r(null):{},this.size=0}return hn=t,hn}var pn,ga;function Ju(){if(ga)return pn;ga=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return pn=r,pn}var _n,ma;function Xu(){if(ma)return _n;ma=1;var r=Nr(),t="__lodash_hash_undefined__",e=Object.prototype,n=e.hasOwnProperty;function i(o){var a=this.__data__;if(r){var s=a[o];return s===t?void 0:s}return n.call(a,o)?a[o]:void 0}return _n=i,_n}var dn,Sa;function Vu(){if(Sa)return dn;Sa=1;var r=Nr(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var o=this.__data__;return r?o[i]!==void 0:e.call(o,i)}return dn=n,dn}var ln,wa;function Zu(){if(wa)return ln;wa=1;var r=Nr(),t="__lodash_hash_undefined__";function e(n,i){var o=this.__data__;return this.size+=this.has(n)?0:1,o[n]=r&&i===void 0?t:i,this}return ln=e,ln}var vn,ba;function Qu(){if(ba)return vn;ba=1;var r=Yu(),t=Ju(),e=Xu(),n=Vu(),i=Zu();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var f=a[s];this.set(f[0],f[1])}}return o.prototype.clear=r,o.prototype.delete=t,o.prototype.get=e,o.prototype.has=n,o.prototype.set=i,vn=o,vn}var yn,Ia;function tf(){if(Ia)return yn;Ia=1;function r(){this.__data__=[],this.size=0}return yn=r,yn}var gn,qa;function rf(){if(qa)return gn;qa=1;function r(t,e){return t===e||t!==t&&e!==e}return gn=r,gn}var mn,Ma;function Dr(){if(Ma)return mn;Ma=1;var r=rf();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return mn=t,mn}var Sn,Oa;function ef(){if(Oa)return Sn;Oa=1;var r=Dr(),t=Array.prototype,e=t.splice;function n(i){var o=this.__data__,a=r(o,i);if(a<0)return!1;var s=o.length-1;return a==s?o.pop():e.call(o,a,1),--this.size,!0}return Sn=n,Sn}var wn,Ea;function nf(){if(Ea)return wn;Ea=1;var r=Dr();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return wn=t,wn}var bn,Ta;function of(){if(Ta)return bn;Ta=1;var r=Dr();function t(e){return r(this.__data__,e)>-1}return bn=t,bn}var In,Ra;function af(){if(Ra)return In;Ra=1;var r=Dr();function t(e,n){var i=this.__data__,o=r(i,e);return o<0?(++this.size,i.push([e,n])):i[o][1]=n,this}return In=t,In}var qn,za;function sf(){if(za)return qn;za=1;var r=tf(),t=ef(),e=nf(),n=of(),i=af();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var f=a[s];this.set(f[0],f[1])}}return o.prototype.clear=r,o.prototype.delete=t,o.prototype.get=e,o.prototype.has=n,o.prototype.set=i,qn=o,qn}var Mn,Ca;function uf(){if(Ca)return Mn;Ca=1;var r=la(),t=Le(),e=r(t,"Map");return Mn=e,Mn}var On,Aa;function ff(){if(Aa)return On;Aa=1;var r=Qu(),t=sf(),e=uf();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return On=n,On}var En,$a;function cf(){if($a)return En;$a=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return En=r,En}var Tn,ka;function Fr(){if(ka)return Tn;ka=1;var r=cf();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Tn=t,Tn}var Rn,Ba;function hf(){if(Ba)return Rn;Ba=1;var r=Fr();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return Rn=t,Rn}var zn,ja;function pf(){if(ja)return zn;ja=1;var r=Fr();function t(e){return r(this,e).get(e)}return zn=t,zn}var Cn,xa;function _f(){if(xa)return Cn;xa=1;var r=Fr();function t(e){return r(this,e).has(e)}return Cn=t,Cn}var An,La;function df(){if(La)return An;La=1;var r=Fr();function t(e,n){var i=r(this,e),o=i.size;return i.set(e,n),this.size+=i.size==o?0:1,this}return An=t,An}var $n,Pa;function lf(){if(Pa)return $n;Pa=1;var r=ff(),t=hf(),e=pf(),n=_f(),i=df();function o(a){var s=-1,u=a==null?0:a.length;for(this.clear();++s<u;){var f=a[s];this.set(f[0],f[1])}}return o.prototype.clear=r,o.prototype.delete=t,o.prototype.get=e,o.prototype.has=n,o.prototype.set=i,$n=o,$n}var kn,Na;function vf(){if(Na)return kn;Na=1;var r=lf(),t="Expected a function";function e(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var o=function(){var a=arguments,s=i?i.apply(this,a):a[0],u=o.cache;if(u.has(s))return u.get(s);var f=n.apply(this,a);return o.cache=u.set(s,f)||u,f};return o.cache=new(e.Cache||r),o}return e.Cache=r,kn=e,kn}var Bn,Da;function yf(){if(Da)return Bn;Da=1;var r=vf(),t=500;function e(n){var i=r(n,function(a){return o.size===t&&o.clear(),a}),o=i.cache;return i}return Bn=e,Bn}var jn,Fa;function gf(){if(Fa)return jn;Fa=1;var r=yf(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,n=r(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(t,function(a,s,u,f){o.push(u?f.replace(e,"$1"):s||a)}),o});return jn=n,jn}var xn,Ua;function mf(){if(Ua)return xn;Ua=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,o=Array(i);++n<i;)o[n]=e(t[n],n,t);return o}return xn=r,xn}var Ln,Ha;function Pn(){if(Ha)return Ln;Ha=1;var r=jr(),t=mf(),e=Mt(),n=Pr(),i=r?r.prototype:void 0,o=i?i.toString:void 0;function a(s){if(typeof s=="string")return s;if(e(s))return t(s,a)+"";if(n(s))return o?o.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return Ln=a,Ln}var Nn,Ka;function Dn(){if(Ka)return Nn;Ka=1;var r=Pn();function t(e){return e==null?"":r(e)}return Nn=t,Nn}var Fn,Wa;function Sf(){if(Wa)return Fn;Wa=1;var r=Mt(),t=Du(),e=gf(),n=Dn();function i(o,a){return r(o)?o:t(o,a)?[o]:e(n(o))}return Fn=i,Fn}var Un,Ga;function wf(){if(Ga)return Un;Ga=1;var r=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function e(n,i){var o=typeof n;return i=i??r,!!i&&(o=="number"||o!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return Un=e,Un}var Hn,Ya;function bf(){if(Ya)return Hn;Ya=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return Hn=t,Hn}var Kn,Ja;function If(){if(Ja)return Kn;Ja=1;var r=Pr();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return Kn=t,Kn}var Wn,Xa;function qf(){if(Xa)return Wn;Xa=1;var r=Sf(),t=Zo(),e=Mt(),n=wf(),i=bf(),o=If();function a(s,u,f){u=r(u,s);for(var c=-1,h=u.length,p=!1;++c<h;){var _=o(u[c]);if(!(p=s!=null&&f(s,_)))break;s=s[_]}return p||++c!=h?p:(h=s==null?0:s.length,!!h&&i(h)&&n(_,h)&&(e(s)||t(s)))}return Wn=a,Wn}var Gn,Va;function Mf(){if(Va)return Gn;Va=1;var r=Nu(),t=qf();function e(n,i){return n!=null&&t(n,i,r)}return Gn=e,Gn}Mf();var Yn,Za;function Of(){if(Za)return Yn;Za=1;var r=Math.max,t=Math.min;function e(n,i,o){return n>=t(i,o)&&n<r(i,o)}return Yn=e,Yn}var Jn,Qa;function Ef(){if(Qa)return Jn;Qa=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return Jn=t,Jn}var Xn,ts;function Tf(){if(ts)return Xn;ts=1;var r=Ef(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return Xn=e,Xn}var Vn,rs;function es(){if(rs)return Vn;rs=1;var r=Tf(),t=rn(),e=Pr(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function u(f){if(typeof f=="number")return f;if(e(f))return n;if(t(f)){var c=typeof f.valueOf=="function"?f.valueOf():f;f=t(c)?c+"":c}if(typeof f!="string")return f===0?f:+f;f=r(f);var h=o.test(f);return h||a.test(f)?s(f.slice(2),h?2:8):i.test(f)?n:+f}return Vn=u,Vn}var Zn,ns;function is(){if(ns)return Zn;ns=1;var r=es(),t=1/0,e=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===t||i===-t){var o=i<0?-1:1;return o*e}return i===i?i:0}return Zn=n,Zn}var Qn,os;function Rf(){if(os)return Qn;os=1;var r=Of(),t=is(),e=es();function n(i,o,a){return o=t(o),a===void 0?(a=o,o=0):a=t(a),i=e(i),r(i,o,a)}return Qn=n,Qn}var zf=Rf();const Cf=Cu(zf);var ti,as;function ri(){if(as)return ti;as=1;var r=is();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return ti=t,ti}var ei,ss;function Af(){if(ss)return ei;ss=1;var r=ri();function t(e){return typeof e=="number"&&e==r(e)}return ei=t,ei}Af();var ni,us;function fs(){if(us)return ni;us=1;function r(t,e,n){var i=-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 a=Array(o);++i<o;)a[i]=t[i+e];return a}return ni=r,ni}var ii,cs;function $f(){if(cs)return ii;cs=1;var r=fs(),t=ri();function e(n,i,o){return n&&n.length?(i=o||i===void 0?1:t(i),r(n,0,i<0?0:i)):[]}return ii=e,ii}$f();const vr="black",yr="white",nt=null;class hs extends k({dimensions:19,moves:j()},"Board"){constructor(t=19,...e){super({dimensions:t,moves:j(e.map(n=>[n.coordinate,n.color]))})}toMap(t=null){const e={[vr]:vr,[yr]:yr,[nt]:nt},n=t||e;return Array(this.dimensions).fill(nt).map((i,o)=>Array(this.dimensions).fill(nt).map((a,s)=>{const u=this.moves.get(ot(s,o),nt);return n[u]||e[u]}))}}function ps(...r){return Reflect.construct(hs,r)}ps.prototype=hs.prototype;class _s extends k({x:0,y:0},"Coordinate"){constructor(t,e){super({x:t,y:e})}}function ot(...r){return Reflect.construct(_s,r)}ot.prototype=_s.prototype;class ds extends k({coordinate:ot(),color:nt},"Move"){constructor(t,e){super({coordinate:t,color:e})}}function ls(...r){return Reflect.construct(ds,r)}ls.prototype=ds.prototype,ot(4,4),ot(6,6),ot(9,9);function kf(r,t){const{x:e,y:n}=t,i=o=>Cf(o,r.dimensions);return _t.of(ot(e,n+1),ot(e,n-1),ot(e+1,n),ot(e-1,n)).filter(o=>i(o.x)&&i(o.y))}function Ur(r,t,e){const n=e===void 0?r.moves.get(t,nt):e;return kf(r,t).filter(i=>r.moves.get(i,nt)===n)}function vs(r,t){let e=_t(),n=_t.of(t);for(;!n.isEmpty();){const i=n.first(),o=Ur(r,i);e=e.add(i),n=n.rest().union(o.subtract(e))}return e}function oi(r){return r===vr?yr:r===yr?vr:nt}function Bf(r,t){return vs(r,t).reduce((e,n)=>e.union(Ur(r,n,nt)),_t())}function ai(r,t){return Bf(r,t).size}function ys(r,t){const e=ai(r.setIn(["moves",t.coordinate],t.color),t.coordinate)>0,n=Ur(r,t.coordinate,oi(t.color)).some(i=>ai(r,i)===1);return e||n}function jf(r,t){return r.setIn(["moves"],t.reduce((e,n)=>e.delete(n),r.moves))}function xf(r,t){if(!ys(r,t))throw new Error("Not a valid position");if(r.moves.has(t.coordinate))throw new Error("There is already a stone there");const e=Ur(r,t.coordinate,oi(t.color)).reduce((n,i)=>n.union(ai(r,i)===1?vs(r,i):_t()),_t());return jf(r,e).setIn(["moves",t.coordinate],t.color)}function Lf(r,t,e,n=!1){const i=r.moves.get(t,nt);if(!n&&oi(i)===e)throw new Error("There is already a stone there. Pass force=true to override.");return r.setIn(["moves",t],e)}const yt={BLACK:vr,Board:ps,Coordinate:ot,EMPTY:nt,Move:ls,WHITE:yr,addMove:xf,isLegalMove:ys,placeStone:Lf};Mt();var si,gs;function Pf(){if(gs)return si;gs=1;var r=xr(),t=Mt(),e=Lr(),n="[object String]";function i(o){return typeof o=="string"||!t(o)&&e(o)&&r(o)==n}return si=i,si}Pf();var ui,ms;function Nf(){if(ms)return ui;ms=1;function r(t,e,n){return t===t&&(n!==void 0&&(t=t<=n?t:n),e!==void 0&&(t=t>=e?t:e)),t}return ui=r,ui}var fi,Ss;function Df(){if(Ss)return fi;Ss=1;var r=Nf(),t=Pn(),e=ri(),n=Dn();function i(o,a,s){return o=n(o),s=s==null?0:r(e(s),0,o.length),a=t(a),o.slice(s,s+a.length)==a}return fi=i,fi}Df();var ci,ws;function Ff(){if(ws)return ci;ws=1;var r=fs();function t(e,n,i){var o=e.length;return i=i===void 0?o:i,!n&&i>=o?e:r(e,n,i)}return ci=t,ci}var hi,bs;function Uf(){if(bs)return hi;bs=1;function r(t,e,n,i){for(var o=t.length,a=n+(i?1:-1);i?a--:++a<o;)if(e(t[a],a,t))return a;return-1}return hi=r,hi}var pi,Is;function Hf(){if(Is)return pi;Is=1;function r(t){return t!==t}return pi=r,pi}var _i,qs;function Kf(){if(qs)return _i;qs=1;function r(t,e,n){for(var i=n-1,o=t.length;++i<o;)if(t[i]===e)return i;return-1}return _i=r,_i}var di,Ms;function Wf(){if(Ms)return di;Ms=1;var r=Uf(),t=Hf(),e=Kf();function n(i,o,a){return o===o?e(i,o,a):r(i,t,a)}return di=n,di}var li,Os;function Gf(){if(Os)return li;Os=1;var r=Wf();function t(e,n){for(var i=-1,o=e.length;++i<o&&r(n,e[i],0)>-1;);return i}return li=t,li}var vi,Es;function Yf(){if(Es)return vi;Es=1;function r(t){return t.split("")}return vi=r,vi}var yi,Ts;function Jf(){if(Ts)return yi;Ts=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,o="\\ufe0e\\ufe0f",a="\\u200d",s=RegExp("["+a+r+i+o+"]");function u(f){return s.test(f)}return yi=u,yi}var gi,Rs;function Xf(){if(Rs)return gi;Rs=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,o="\\ufe0e\\ufe0f",a="["+r+"]",s="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",f="(?:"+s+"|"+u+")",c="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",_="\\u200d",d=f+"?",v="["+o+"]?",w="(?:"+_+"(?:"+[c,h,p].join("|")+")"+v+d+")*",I=v+d+w,y="(?:"+[c+s+"?",s,h,p,a].join("|")+")",g=RegExp(u+"(?="+u+")|"+y+I,"g");function l(b){return b.match(g)||[]}return gi=l,gi}var mi,zs;function Vf(){if(zs)return mi;zs=1;var r=Yf(),t=Jf(),e=Xf();function n(i){return t(i)?e(i):r(i)}return mi=n,mi}var Si,Cs;function Zf(){if(Cs)return Si;Cs=1;var r=Pn(),t=Ff(),e=Gf(),n=Vf(),i=Dn(),o=/^\s+/;function a(s,u,f){if(s=i(s),s&&(f||u===void 0))return s.replace(o,"");if(!s||!(u=r(u)))return s;var c=n(s),h=e(c,n(u));return t(c,h).join("")}return Si=a,Si}Zf();const W=yt.BLACK,wi=yt.Board,Ot=yt.Coordinate,gr=yt.EMPTY,jt=yt.Move,at=yt.WHITE,Vt=yt.addMove,As=yt.isLegalMove,Qf=yt.placeStone;function Hr(r){return`
|
|
2
2
|
<div style="background: #fee2e2; color: #991b1b; padding: 1rem; border-radius: 4px;">${r}</div>
|
|
3
|
-
`}function wi(r,t,e){const n=r.dimensions,i=t??n,o=e??n,a=30,s=a,u=a*.4,f=n===o,c=n===i,h=(f?o-1:o)*a+s*2,p=(c?i-1:i)*a+s*2;let _=`<svg width="${h}" height="${p}" xmlns="http://www.w3.org/2000/svg">`;_+=`<rect width="${h}" height="${p}" fill="#dcb35c"/>`;const d=o<n,v=i<n,w=s+(d?o:o-1)*a,I=s+(v?i:i-1)*a;for(let l=0;l<o;l++){const g=s+l*a;_+=`<line x1="${g}" y1="${s}" x2="${g}" y2="${I}" stroke="#000" stroke-width="1"/>`}for(let l=0;l<i;l++){const g=s+l*a;_+=`<line x1="${s}" y1="${g}" x2="${w}" y2="${g}" stroke="#000" stroke-width="1"/>`}const y=[];n===9?y.push([2,2],[2,6],[4,4],[6,2],[6,6]):n===13?y.push([3,3],[3,9],[6,6],[9,3],[9,9]):n===19&&y.push([3,3],[3,9],[3,15],[9,3],[9,9],[9,15],[15,3],[15,9],[15,15]);for(const[l,g]of y)if(l<i&&g<o){const A=s+g*a,b=s+l*a;_+=`<circle cx="${A}" cy="${b}" r="3" fill="#000"/>`}for(let l=0;l<i;l++)for(let g=0;g<o;g++){const A=r.moves.get(Ot(l,g),yr);if(A!==yr){const b=s+g*a,q=s+l*a;A===K?_+=`<circle cx="${b}" cy="${q}" r="${u}" fill="#000" stroke="#000" stroke-width="1"/>`:A===at&&(_+=`<circle cx="${b}" cy="${q}" r="${u}" fill="#fff" stroke="#000" stroke-width="1"/>`)}}return _+="</svg>",_}class dt extends Error{constructor(t){super(t),this.name="ValidationError"}}function bi(r,t){const e={};let n=null,i=!1;for(let o=t;o<r.length;o++){const a=r[o].trim();if(a==="")continue;const s=a.indexOf(":");if(s>0){const u=a.substring(0,s).trim(),f=a.substring(s+1).trim();e[u]=f,n=u,i=f===""}else n&&i&&(Array.isArray(e[n])?e[n].push(a):e[n]=[a])}return e}function Ii(r,t={}){const{allowEmpty:e=!1,validateCharacters:n=!0,ignoreRules:i=!1}=t;let o=1;for(;o<r.length&&r[o].trim()==="";)o++;if(o>=r.length)throw new dt("No board definition or options found");const a=[];let s=o;for(let y=o;y<r.length;y++){const l=r[y];if(l.trim()===""){s=y;break}if(l.indexOf(":")>0){s=y;break}a.push(l),s=y+1}const u=bi(r,s);let f;if(u.size){const y=u.size;if(Array.isArray(y))throw new dt("Size option cannot have multiple values");const l=parseInt(y,10);if(isNaN(l)||l<=1||l>19)throw new dt("Size must be a positive integer greater than 1 and less than or equal to 19");f=l}if(a.length===0){if(!e)throw new dt("Board definition is required");if(!f)throw new dt('Empty board requires a "size" option');return{board:Si(f),rowCount:f,columnCount:f,configStartIndex:s,otherMarks:{}}}const c=a.map(y=>y.replace(/\s/g,"").length),h=c[0];if(!c.every(y=>y===h))throw new dt("All board rows must have the same number of non-space characters");const p=a.length,_=a[0].replace(/\s/g,"").length,d=p===_;if(f&&(p>f||_>f))throw new dt(`Board dimensions (${p}x${_}) exceed specified size (${f})`);if(!d&&!f)throw new dt(`Rectangle boards require a "size" option (found ${p}x${_} board)`);f||(f=p);const v=[],w={};for(let y=0;y<a.length;y++){const l=a[y];let g=0;for(let A=0;A<l.length;A++){const b=l[A];if(b===" ")continue;const q=/^[.+XOxo]$/.test(b);if(n&&!q)throw new dt(`Invalid board character '${b}' at row ${y+1}, col ${g+1}. Valid characters: . or + (empty), X or x (black stone), O or o (white stone)`);let M=yr;b==="X"||b==="x"?M=K:b==="O"||b==="o"?M=at:b==="."||b==="+"?M=yr:n||(w[b]||(w[b]=[]),w[b].push(Ot(y,g))),M!==yr&&v.push(kt(Ot(y,g),M)),g++}}let I;if(i){I=Si(f);for(const y of v)I=Zf(I,y.coordinate,y.color)}else I=Si(f,...v);return{board:I,rowCount:p,columnCount:_,configStartIndex:s,otherMarks:w}}const U={Success:"success",Failure:"failure",Incomplete:"incomplete"};class As{parsedBoard;element;constructor(t,e){this.element=t;let n=1;for(;n<e.length&&e[n].trim()==="";)n++;let i=n;for(let u=n;u<e.length;u++){const f=e[u];if(f.trim()===""||f.indexOf(":")>0){i=u;break}}const a=bi(e,i)["ignore-rules"],s=a==="true"||a==="1";this.parsedBoard=Ii(e,{ignoreRules:s})}render(){const t=this.element,{board:e,rowCount:n,columnCount:i}=this.parsedBoard,o=wi(e,n,i);t.innerHTML=o}}class $s{parsedBoard;element;toPlay;sequenceTree;result;currentTree;playedMoves;currentBoard;isBlackTurn;constructor(t,e){this.element=t;const n=Ii(e,{allowEmpty:!1,validateCharacters:!1});for(const[l,g]of Object.entries(n.otherMarks))if(g.length>1)throw new Error(`Mark '${l}' appears at multiple coordinates. Each mark must be unique.`);const i=bi(e,n.configStartIndex),o=i.black,a=i.white,s=o?Array.isArray(o)?o:o.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],u=a?Array.isArray(a)?a:a.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],f=new Set(u),c=s.filter(l=>f.has(l));if(c.length>0)throw new Error(`Marks cannot appear in both black and white: ${c.join(", ")}`);const h=new Set(Object.keys(n.otherMarks));for(const l of s)if(!h.has(l))throw new Error(`Black mark '${l}' does not appear in the board`);for(const l of u)if(!h.has(l))throw new Error(`White mark '${l}' does not appear in the board`);const p=i["to-play"],_=p?(Array.isArray(p)?p[0]:p).toLowerCase():"";if(_&&_!=="black"&&_!=="white")throw new Error(`Invalid to-play value '${_}'. Must be 'black' or 'white'`);this.toPlay=_==="white"?at:K;let d=n.board;for(const l of s){const g=n.otherMarks[l];for(const A of g)d=Xt(d,kt(A,K))}for(const l of u){const g=n.otherMarks[l];for(const A of g)d=Xt(d,kt(A,at))}this.parsedBoard={...n,board:d},this.result=U.Incomplete,this.currentTree=B(),this.playedMoves=[],this.currentBoard=d,this.isBlackTurn=this.toPlay===K;const v=(l,g)=>{const A=l.split(">").map(M=>M.trim()).filter(M=>M.length>0);for(let M=0;M<A.length;M++){const k=A[M];if(k==="*"){if(!(M%2===0))throw new Error(`${g} '${l}': wildcard '*' can only be used for player moves, not computer responses (position ${M+1})`);continue}if(!n.otherMarks[k])throw new Error(`${g} '${l}': mark '${k}' does not appear in the board`)}let b=d,q=this.toPlay;for(let M=0;M<A.length;M++){const k=A[M];if(k==="*"){q=q===K?at:K;continue}const Et=n.otherMarks[k][0],Bt=kt(Et,q);if(!Cs(b,Bt))throw new Error(`${g} '${l}': move ${M+1} (${k}) is illegal`);try{b=Xt(b,Bt)}catch(st){const gr=st instanceof Error?st.message:String(st);throw new Error(`${g} '${l}': move ${M+1} (${k}) failed - ${gr}`)}q=q===K?at:K}},w=i.solutions,I=[];if(w){const l=Array.isArray(w)?w:[w];for(const g of l)v(g,"Solution"),I.push({sequence:g,isSolution:!0})}const y=i.sequences;if(y){const l=Array.isArray(y)?y:[y];for(const g of l)v(g,"Sequence"),I.push({sequence:g,isSolution:!1})}this.sequenceTree=B();for(const{sequence:l,isSolution:g}of I){const A=l.split(">").map(q=>q.trim()).filter(q=>q.length>0),b=[];for(const q of A)q==="*"?b.push("*"):b.push(n.otherMarks[q][0]);if(b[0]==="*"){let q=B();for(let k=b.length-1;k>=1;k--){const Q=b[k];if(Q==="*")throw new Error(`Sequence '${l}': cannot have consecutive wildcards`);const Et=Q,gr={result:k===b.length-1?g?U.Success:U.Failure:U.Incomplete,children:q,wildcardChild:void 0};q=B().set(Et,gr)}const M={result:U.Incomplete,children:q,wildcardChild:void 0};this.sequenceTree=this.applyWildcardToTree(this.sequenceTree,M)}else{let q=B(),M=B(),k=!1;for(let Q=b.length-1;Q>=0;Q--){const Et=b[Q],Bt=Q===b.length-1;let st;if(Bt?st=g?U.Success:U.Failure:st=U.Incomplete,Et==="*"){k=!0;continue}const gr=Et;k&&(M=q,q=B(),k=!1);const ic={result:st,children:q,wildcardChild:M.size>0?{result:U.Incomplete,children:M,wildcardChild:void 0}:void 0};q=B().set(gr,ic),M=B()}this.sequenceTree=this.mergeSequenceTrees(this.sequenceTree,q)}}this.currentTree=this.sequenceTree}applyWildcardToTree(t,e){return t.map(n=>({result:n.result,children:n.children,wildcardChild:e}))}mergeSequenceTrees(t,e){return e.reduce((n,i,o)=>{const a=n.get(o);if(a){const s=this.mergeSequenceTrees(a.children,i.children);let u;if(a.wildcardChild&&i.wildcardChild){const p=B().set(Ot(0,0),a.wildcardChild),_=B().set(Ot(0,0),i.wildcardChild);u=this.mergeSequenceTrees(p,_).get(Ot(0,0))}else u=a.wildcardChild||i.wildcardChild;const h={result:s.size>0||u!==void 0?U.Incomplete:a.result,children:s,wildcardChild:u};return n.set(o,h)}else return n.set(o,i)},t)}handleUserMove(t){let e=this.currentTree.get(t);if(!e){const o=Array.from(this.currentTree.values()).filter(a=>a.wildcardChild);if(o.length>0){const a=o[0];a.wildcardChild&&(e=a.wildcardChild)}}const n=this.isBlackTurn?K:at,i=kt(t,n);if(this.playedMoves.push(i),this.currentBoard=Xt(this.currentBoard,i),this.isBlackTurn=!this.isBlackTurn,!e){this.result!==U.Success&&(this.result=U.Failure),this.currentTree=B(),this.render();return}this.currentTree=e.children,this.result=e.result,this.render(),e.children.size>0&&setTimeout(()=>this.playComputerResponse(),500)}playComputerResponse(){const t=Array.from(this.currentTree.entries());if(t.length===0)return;const e=Math.floor(Math.random()*t.length),[n,i]=t[e],o=this.isBlackTurn?K:at,a=kt(n,o);this.playedMoves.push(a),this.currentBoard=Xt(this.currentBoard,a),this.isBlackTurn=!this.isBlackTurn,this.currentTree=i.children,this.result=i.result,this.render()}reset(){this.currentTree=this.sequenceTree,this.playedMoves=[],this.currentBoard=this.parsedBoard.board,this.isBlackTurn=this.toPlay===K,this.result=U.Incomplete,this.render()}render(){const t=this.element,{rowCount:e,columnCount:n}=this.parsedBoard;let o=wi(this.currentBoard,e,n);const a=`reset-${Math.random().toString(36).substr(2,9)}`,s="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 0.9rem;";o+='<div style="margin-top: 1rem; display: flex; align-items: center;">',o+=`<button id="${a}" style="${s}">Reset</button>`,this.result===U.Success?o+='<span style="margin-left: 1rem; font-weight: 600; font-size: 1.1rem; color: #155724;">Success!</span>':this.result===U.Failure&&(o+='<span style="margin-left: 1rem; font-weight: 600; font-size: 1.1rem; color: #721c24;">Incorrect</span>'),o+="</div>",t.innerHTML=o;const u=t.querySelector("svg");u&&(u.style.cursor="pointer",u.addEventListener("click",c=>{const h=c,p=u.getBoundingClientRect(),_=h.clientX-p.left,d=h.clientY-p.top,v=30,w=v,I=Math.round((_-w)/v),y=Math.round((d-w)/v);if(y>=0&&y<e&&I>=0&&I<n){const l=Ot(y,I);this.handleUserMove(l)}}));const f=document.getElementById(a);f&&f.addEventListener("click",()=>this.reset())}}class ks{parsedBoard;element;currentBoard;initialBoard;history;currentMoveIndex;isBlackTurn;constructor(t,e){this.element=t,this.parsedBoard=Ii(e,{allowEmpty:!0}),this.initialBoard=this.parsedBoard.board,this.currentBoard=this.parsedBoard.board,this.history=[],this.currentMoveIndex=-1,this.isBlackTurn=!0}rebuildBoard(){let t=this.initialBoard;for(let e=0;e<=this.currentMoveIndex;e++){const n=this.history[e];n.type==="move"&&(t=Xt(t,n.move))}if(this.currentBoard=t,this.currentMoveIndex===-1)this.isBlackTurn=!0;else{const e=this.history[this.currentMoveIndex],n=e.type==="move"?e.move.color:e.color;this.isBlackTurn=n===at}}undo(){this.currentMoveIndex>=0&&(this.currentMoveIndex--,this.rebuildBoard(),this.render())}redo(){this.currentMoveIndex<this.history.length-1&&(this.currentMoveIndex++,this.rebuildBoard(),this.render())}pass(){this.history=this.history.slice(0,this.currentMoveIndex+1);const t=this.isBlackTurn?K:at;this.history.push({type:"pass",color:t}),this.currentMoveIndex++,this.isBlackTurn=!this.isBlackTurn,this.render()}reset(){this.history=[],this.currentMoveIndex=-1,this.currentBoard=this.initialBoard,this.isBlackTurn=!0,this.render()}render(){const t=this.element,{rowCount:e,columnCount:n}=this.parsedBoard,i=wi(this.currentBoard,e,n),o=`turn-info-${Math.random().toString(36).substr(2,9)}`,a=`undo-${Math.random().toString(36).substr(2,9)}`,s=`redo-${Math.random().toString(36).substr(2,9)}`,u=`pass-${Math.random().toString(36).substr(2,9)}`,f=`reset-${Math.random().toString(36).substr(2,9)}`;let c='<div class="freeplay-container">';c+=`<div id="${o}" style="margin-bottom: 1rem; padding: 0.5rem; font-weight: 600; font-size: 1.1rem;">${this.isBlackTurn?"Black":"White"} to play</div>`,c+=i;const h="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 0.9rem;",p="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #f0f0f0; cursor: not-allowed; font-size: 0.9rem; color: #999;";c+='<div style="margin-top: 1rem;">',c+=`<button id="${a}" style="${this.currentMoveIndex>=0?h:p}" ${this.currentMoveIndex<0?"disabled":""}>← Undo</button>`,c+=`<button id="${s}" style="${this.currentMoveIndex<this.history.length-1?h:p}" ${this.currentMoveIndex>=this.history.length-1?"disabled":""}>Redo →</button>`,c+=`<button id="${u}" style="${h}">Pass</button>`,c+=`<button id="${f}" style="${h}">Reset</button>`,c+="</div>",c+="</div>",t.innerHTML=c;const _=t.querySelector("svg"),d=document.getElementById(a),v=document.getElementById(s),w=document.getElementById(u),I=document.getElementById(f);_&&(_.style.cursor="pointer",_.addEventListener("click",y=>{const l=y,g=_.getBoundingClientRect(),A=l.clientX-g.left,b=l.clientY-g.top,q=30,M=q,k=Math.round((A-M)/q),Q=Math.round((b-M)/q);if(Q>=0&&Q<e&&k>=0&&k<n){const Et=Ot(Q,k),Bt=this.isBlackTurn?K:at,st=kt(Et,Bt);Cs(this.currentBoard,st)&&(this.history=this.history.slice(0,this.currentMoveIndex+1),this.history.push({type:"move",move:st}),this.currentMoveIndex++,this.rebuildBoard(),this.render())}})),d&&d.addEventListener("click",()=>this.undo()),v&&v.addEventListener("click",()=>this.redo()),w&&w.addEventListener("click",()=>this.pass()),I&&I.addEventListener("click",()=>this.reset())}}const Qf={static:As,freeplay:ks,problem:$s},tc="0.0.0",rc=".godash-diagram";function ec(r,t){const e=t.split(`
|
|
4
|
-
`);if(e.length===0){r.innerHTML=
|
|
3
|
+
`}function bi(r,t,e){const n=r.dimensions,i=t??n,o=e??n,a=30,s=a,u=a*.4,f=n===o,c=n===i,h=(f?o-1:o)*a+s*2,p=(c?i-1:i)*a+s*2;let _=`<svg width="${h}" height="${p}" xmlns="http://www.w3.org/2000/svg">`;_+=`<rect width="${h}" height="${p}" fill="#dcb35c"/>`;const d=o<n,v=i<n,w=s+(d?o:o-1)*a,I=s+(v?i:i-1)*a;for(let g=0;g<o;g++){const l=s+g*a;_+=`<line x1="${l}" y1="${s}" x2="${l}" y2="${I}" stroke="#000" stroke-width="1"/>`}for(let g=0;g<i;g++){const l=s+g*a;_+=`<line x1="${s}" y1="${l}" x2="${w}" y2="${l}" stroke="#000" stroke-width="1"/>`}const y=[];n===9?y.push([2,2],[2,6],[4,4],[6,2],[6,6]):n===13?y.push([3,3],[3,9],[6,6],[9,3],[9,9]):n===19&&y.push([3,3],[3,9],[3,15],[9,3],[9,9],[9,15],[15,3],[15,9],[15,15]);for(const[g,l]of y)if(g<i&&l<o){const b=s+l*a,M=s+g*a;_+=`<circle cx="${b}" cy="${M}" r="3" fill="#000"/>`}for(let g=0;g<i;g++)for(let l=0;l<o;l++){const b=r.moves.get(Ot(g,l),gr);if(b!==gr){const M=s+l*a,$=s+g*a;b===W?_+=`<circle cx="${M}" cy="${$}" r="${u}" fill="#000" stroke="#000" stroke-width="1"/>`:b===at&&(_+=`<circle cx="${M}" cy="${$}" r="${u}" fill="#fff" stroke="#000" stroke-width="1"/>`)}}return _+="</svg>",_}class dt extends Error{constructor(t){super(t),this.name="ValidationError"}}function Ii(r,t){const e={};let n=null,i=!1;for(let o=t;o<r.length;o++){const a=r[o].trim();if(a==="")continue;const s=a.indexOf(":");if(s>0){const u=a.substring(0,s).trim(),f=a.substring(s+1).trim();e[u]=f,n=u,i=f===""}else n&&i&&(Array.isArray(e[n])?e[n].push(a):e[n]=[a])}return e}function qi(r,t={}){const{allowEmpty:e=!1,validateCharacters:n=!0,ignoreRules:i=!1}=t;let o=1;for(;o<r.length&&r[o].trim()==="";)o++;if(o>=r.length)throw new dt("No board definition or options found");const a=[];let s=o;for(let y=o;y<r.length;y++){const g=r[y];if(g.trim()===""){s=y;break}if(g.indexOf(":")>0){s=y;break}a.push(g),s=y+1}const u=Ii(r,s);let f;if(u.size){const y=u.size;if(Array.isArray(y))throw new dt("Size option cannot have multiple values");const g=parseInt(y,10);if(isNaN(g)||g<=1||g>19)throw new dt("Size must be a positive integer greater than 1 and less than or equal to 19");f=g}if(a.length===0){if(!e)throw new dt("Board definition is required");if(!f)throw new dt('Empty board requires a "size" option');return{board:wi(f),rowCount:f,columnCount:f,configStartIndex:s,otherMarks:{}}}const c=a.map(y=>y.replace(/\s/g,"").length),h=c[0];if(!c.every(y=>y===h))throw new dt("All board rows must have the same number of non-space characters");const p=a.length,_=a[0].replace(/\s/g,"").length,d=p===_;if(f&&(p>f||_>f))throw new dt(`Board dimensions (${p}x${_}) exceed specified size (${f})`);if(!d&&!f)throw new dt(`Rectangle boards require a "size" option (found ${p}x${_} board)`);f||(f=p);const v=[],w={};for(let y=0;y<a.length;y++){const g=a[y];let l=0;for(let b=0;b<g.length;b++){const M=g[b];if(M===" ")continue;const $=/^[.+XOxo]$/.test(M);if(n&&!$)throw new dt(`Invalid board character '${M}' at row ${y+1}, col ${l+1}. Valid characters: . or + (empty), X or x (black stone), O or o (white stone)`);let q=gr;M==="X"||M==="x"?q=W:M==="O"||M==="o"?q=at:M==="."||M==="+"?q=gr:n||(w[M]||(w[M]=[]),w[M].push(Ot(y,l))),q!==gr&&v.push(jt(Ot(y,l),q)),l++}}let I;if(i){I=wi(f);for(const y of v)I=Qf(I,y.coordinate,y.color)}else I=wi(f,...v);return{board:I,rowCount:p,columnCount:_,configStartIndex:s,otherMarks:w}}const H={Success:"success",Failure:"failure",Incomplete:"incomplete"};class $s{parsedBoard;element;constructor(t,e){this.element=t;let n=1;for(;n<e.length&&e[n].trim()==="";)n++;let i=n;for(let u=n;u<e.length;u++){const f=e[u];if(f.trim()===""||f.indexOf(":")>0){i=u;break}}const a=Ii(e,i)["ignore-rules"],s=a==="true"||a==="1";this.parsedBoard=qi(e,{ignoreRules:s})}render(){const t=this.element,{board:e,rowCount:n,columnCount:i}=this.parsedBoard,o=bi(e,n,i);t.innerHTML=o}}class ks{parsedBoard;element;toPlay;sequenceTree;result;currentTree;currentWildcard;playedMoves;currentBoard;isBlackTurn;constructor(t,e){this.element=t;const n=qi(e,{allowEmpty:!1,validateCharacters:!1});for(const[l,b]of Object.entries(n.otherMarks))if(b.length>1)throw new Error(`Mark '${l}' appears at multiple coordinates. Each mark must be unique.`);const i=Ii(e,n.configStartIndex),o=i.black,a=i.white,s=o?Array.isArray(o)?o:o.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],u=a?Array.isArray(a)?a:a.split(",").map(l=>l.trim()).filter(l=>l.length>0):[],f=new Set(u),c=s.filter(l=>f.has(l));if(c.length>0)throw new Error(`Marks cannot appear in both black and white: ${c.join(", ")}`);const h=new Set(Object.keys(n.otherMarks));for(const l of s)if(!h.has(l))throw new Error(`Black mark '${l}' does not appear in the board`);for(const l of u)if(!h.has(l))throw new Error(`White mark '${l}' does not appear in the board`);const p=i["to-play"],_=p?(Array.isArray(p)?p[0]:p).toLowerCase():"";if(_&&_!=="black"&&_!=="white")throw new Error(`Invalid to-play value '${_}'. Must be 'black' or 'white'`);this.toPlay=_==="white"?at:W;let d=n.board;for(const l of s){const b=n.otherMarks[l];for(const M of b)d=Vt(d,jt(M,W))}for(const l of u){const b=n.otherMarks[l];for(const M of b)d=Vt(d,jt(M,at))}this.parsedBoard={...n,board:d},this.result=H.Incomplete,this.currentTree=j(),this.currentWildcard=void 0,this.playedMoves=[],this.currentBoard=d,this.isBlackTurn=this.toPlay===W;const v=(l,b)=>{const M=l.split(">").map(R=>R.trim()).filter(R=>R.length>0);for(let R=0;R<M.length;R++){const B=M[R];if(B==="*"){if(!(R%2===0))throw new Error(`${b} '${l}': wildcard '*' can only be used for player moves, not computer responses (position ${R+1})`);continue}if(!n.otherMarks[B])throw new Error(`${b} '${l}': mark '${B}' does not appear in the board`)}let $=d,q=this.toPlay;for(let R=0;R<M.length;R++){const B=M[R];if(B==="*"){q=q===W?at:W;continue}const Et=n.otherMarks[B][0],Tt=jt(Et,q);if(!As($,Tt))throw new Error(`${b} '${l}': move ${R+1} (${B}) is illegal`);try{$=Vt($,Tt)}catch(Rt){const mr=Rt instanceof Error?Rt.message:String(Rt);throw new Error(`${b} '${l}': move ${R+1} (${B}) failed - ${mr}`)}q=q===W?at:W}},w=i.solutions,I=[];if(w){const l=Array.isArray(w)?w:[w];for(const b of l)v(b,"Solution"),I.push({sequence:b,isSolution:!0})}const y=i.sequences;if(y){const l=Array.isArray(y)?y:[y];for(const b of l)v(b,"Sequence"),I.push({sequence:b,isSolution:!1})}this.sequenceTree=j();for(const{sequence:l,isSolution:b}of I){const M=l.split(">").map(q=>q.trim()).filter(q=>q.length>0),$=[];for(const q of M)q==="*"?$.push("*"):$.push(n.otherMarks[q][0]);if($[0]==="*"){let q=j();for(let B=$.length-1;B>=1;B--){const st=$[B];if(st==="*")throw new Error(`Sequence '${l}': cannot have consecutive wildcards`);const Et=st,mr={result:B===$.length-1?b?H.Success:H.Failure:H.Incomplete,children:q,wildcardChild:void 0};q=j().set(Et,mr)}const R={result:H.Incomplete,children:q,wildcardChild:void 0};this.sequenceTree=this.applyWildcardToTree(this.sequenceTree,R)}else{let q=j(),R=j(),B=!1;for(let st=$.length-1;st>=0;st--){const Et=$[st],Tt=st===$.length-1;let Rt;if(Tt?Rt=b?H.Success:H.Failure:Rt=H.Incomplete,Et==="*"){B=!0;continue}const mr=Et;B&&(R=q,q=j(),B=!1);const oc={result:Rt,children:q,wildcardChild:R.size>0?{result:H.Incomplete,children:R,wildcardChild:void 0}:void 0};q=j().set(mr,oc),R=j()}this.sequenceTree=this.mergeSequenceTrees(this.sequenceTree,q)}}this.currentTree=this.sequenceTree;const g=Array.from(this.sequenceTree.values()).filter(l=>l.wildcardChild);this.currentWildcard=g.length>0?g[0].wildcardChild:void 0}applyWildcardToTree(t,e){return t.map(n=>({result:n.result,children:n.children,wildcardChild:e}))}mergeSequenceTrees(t,e){return e.reduce((n,i,o)=>{const a=n.get(o);if(a){const s=this.mergeSequenceTrees(a.children,i.children);let u;if(a.wildcardChild&&i.wildcardChild){const p=j().set(Ot(0,0),a.wildcardChild),_=j().set(Ot(0,0),i.wildcardChild);u=this.mergeSequenceTrees(p,_).get(Ot(0,0))}else u=a.wildcardChild||i.wildcardChild;const h={result:s.size>0||u!==void 0?H.Incomplete:a.result,children:s,wildcardChild:u};return n.set(o,h)}else return n.set(o,i)},t)}handleUserMove(t){let e=this.currentTree.get(t);!e&&this.currentWildcard&&(e=this.currentWildcard);const n=this.isBlackTurn?W:at,i=jt(t,n);if(this.playedMoves.push(i),this.currentBoard=Vt(this.currentBoard,i),this.isBlackTurn=!this.isBlackTurn,!e){this.result!==H.Success&&(this.result=H.Failure),this.currentTree=j(),this.currentWildcard=void 0,this.render();return}this.currentTree=e.children,this.currentWildcard=e.wildcardChild,this.result=e.result,this.render(),e.children.size>0&&setTimeout(()=>this.playComputerResponse(),500)}playComputerResponse(){const t=Array.from(this.currentTree.entries());if(t.length===0)return;const e=Math.floor(Math.random()*t.length),[n,i]=t[e],o=this.isBlackTurn?W:at,a=jt(n,o);this.playedMoves.push(a),this.currentBoard=Vt(this.currentBoard,a),this.isBlackTurn=!this.isBlackTurn,this.currentTree=i.children,this.currentWildcard=i.wildcardChild,this.result=i.result,this.render()}reset(){this.currentTree=this.sequenceTree;const t=Array.from(this.sequenceTree.values()).filter(e=>e.wildcardChild);this.currentWildcard=t.length>0?t[0].wildcardChild:void 0,this.playedMoves=[],this.currentBoard=this.parsedBoard.board,this.isBlackTurn=this.toPlay===W,this.result=H.Incomplete,this.render()}render(){const t=this.element,{rowCount:e,columnCount:n}=this.parsedBoard;let o=bi(this.currentBoard,e,n);const a=`reset-${Math.random().toString(36).substr(2,9)}`,s="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 0.9rem;";o+='<div style="margin-top: 1rem; display: flex; align-items: center;">',o+=`<button id="${a}" style="${s}">Reset</button>`,this.result===H.Success?o+='<span style="margin-left: 1rem; font-weight: 600; font-size: 1.1rem; color: #155724;">Success!</span>':this.result===H.Failure&&(o+='<span style="margin-left: 1rem; font-weight: 600; font-size: 1.1rem; color: #721c24;">Incorrect</span>'),o+="</div>",t.innerHTML=o;const u=t.querySelector("svg");u&&(u.style.cursor="pointer",u.addEventListener("click",c=>{const h=c,p=u.getBoundingClientRect(),_=h.clientX-p.left,d=h.clientY-p.top,v=30,w=v,I=Math.round((_-w)/v),y=Math.round((d-w)/v);if(y>=0&&y<e&&I>=0&&I<n){const g=Ot(y,I);this.handleUserMove(g)}}));const f=document.getElementById(a);f&&f.addEventListener("click",()=>this.reset())}}class Bs{parsedBoard;element;currentBoard;initialBoard;history;currentMoveIndex;isBlackTurn;constructor(t,e){this.element=t,this.parsedBoard=qi(e,{allowEmpty:!0}),this.initialBoard=this.parsedBoard.board,this.currentBoard=this.parsedBoard.board,this.history=[],this.currentMoveIndex=-1,this.isBlackTurn=!0}rebuildBoard(){let t=this.initialBoard;for(let e=0;e<=this.currentMoveIndex;e++){const n=this.history[e];n.type==="move"&&(t=Vt(t,n.move))}if(this.currentBoard=t,this.currentMoveIndex===-1)this.isBlackTurn=!0;else{const e=this.history[this.currentMoveIndex],n=e.type==="move"?e.move.color:e.color;this.isBlackTurn=n===at}}undo(){this.currentMoveIndex>=0&&(this.currentMoveIndex--,this.rebuildBoard(),this.render())}redo(){this.currentMoveIndex<this.history.length-1&&(this.currentMoveIndex++,this.rebuildBoard(),this.render())}pass(){this.history=this.history.slice(0,this.currentMoveIndex+1);const t=this.isBlackTurn?W:at;this.history.push({type:"pass",color:t}),this.currentMoveIndex++,this.isBlackTurn=!this.isBlackTurn,this.render()}reset(){this.history=[],this.currentMoveIndex=-1,this.currentBoard=this.initialBoard,this.isBlackTurn=!0,this.render()}render(){const t=this.element,{rowCount:e,columnCount:n}=this.parsedBoard,i=bi(this.currentBoard,e,n),o=`turn-info-${Math.random().toString(36).substr(2,9)}`,a=`undo-${Math.random().toString(36).substr(2,9)}`,s=`redo-${Math.random().toString(36).substr(2,9)}`,u=`pass-${Math.random().toString(36).substr(2,9)}`,f=`reset-${Math.random().toString(36).substr(2,9)}`;let c='<div class="freeplay-container">';c+=`<div id="${o}" style="margin-bottom: 1rem; padding: 0.5rem; font-weight: 600; font-size: 1.1rem;">${this.isBlackTurn?"Black":"White"} to play</div>`,c+=i;const h="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 0.9rem;",p="padding: 0.5rem 1rem; margin: 0.5rem 0.25rem; border: 1px solid #ccc; border-radius: 4px; background: #f0f0f0; cursor: not-allowed; font-size: 0.9rem; color: #999;";c+='<div style="margin-top: 1rem;">',c+=`<button id="${a}" style="${this.currentMoveIndex>=0?h:p}" ${this.currentMoveIndex<0?"disabled":""}>← Undo</button>`,c+=`<button id="${s}" style="${this.currentMoveIndex<this.history.length-1?h:p}" ${this.currentMoveIndex>=this.history.length-1?"disabled":""}>Redo →</button>`,c+=`<button id="${u}" style="${h}">Pass</button>`,c+=`<button id="${f}" style="${h}">Reset</button>`,c+="</div>",c+="</div>",t.innerHTML=c;const _=t.querySelector("svg"),d=document.getElementById(a),v=document.getElementById(s),w=document.getElementById(u),I=document.getElementById(f);_&&(_.style.cursor="pointer",_.addEventListener("click",y=>{const g=y,l=_.getBoundingClientRect(),b=g.clientX-l.left,M=g.clientY-l.top,$=30,q=$,R=Math.round((b-q)/$),B=Math.round((M-q)/$);if(B>=0&&B<e&&R>=0&&R<n){const st=Ot(B,R),Et=this.isBlackTurn?W:at,Tt=jt(st,Et);As(this.currentBoard,Tt)&&(this.history=this.history.slice(0,this.currentMoveIndex+1),this.history.push({type:"move",move:Tt}),this.currentMoveIndex++,this.rebuildBoard(),this.render())}})),d&&d.addEventListener("click",()=>this.undo()),v&&v.addEventListener("click",()=>this.redo()),w&&w.addEventListener("click",()=>this.pass()),I&&I.addEventListener("click",()=>this.reset())}}const tc={static:$s,freeplay:Bs,problem:ks},rc="0.0.0",ec=".godash-diagram";function nc(r,t){const e=t.split(`
|
|
4
|
+
`);if(e.length===0){r.innerHTML=Hr("Empty diagram source");return}const n=e[0].trim();try{let i;switch(n){case"static":i=new $s(r,e);break;case"freeplay":i=new Bs(r,e);break;case"problem":i=new ks(r,e);break;default:r.innerHTML=Hr(`Unsupported diagram type "${n}". Supported types: ${Object.keys(tc).join(", ")}`);return}i.render()}catch(i){i instanceof dt?r.innerHTML=Hr(i.message):r.innerHTML=Hr(i instanceof Error?i.message:String(i))}}function ic(r,t){const e=r??ec,n=document.querySelectorAll(e);if(n.length===0)throw new Error(`No elements found for selector: ${e}`);n.forEach(i=>{const o=t?.diagramSource??i.textContent??"";nc(i,o)})}zt.init=ic,zt.version=rc,Object.defineProperty(zt,Symbol.toStringTag,{value:"Module"})}));
|