godash-diagrams 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Godash Diagrams
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/godash-diagrams)](https://www.npmjs.com/package/godash-diagrams)
4
+
3
5
  A diagramming library for [Go](https://en.wikipedia.org/wiki/Go_(game)), inspired by [Mermaid](https://mermaid.js.org/), and built on [Godash](https://duckpunch.github.io/godash/).
4
6
 
5
7
  [**Try it live →**](https://duckpunch.github.io/godash-diagrams/)
@@ -47,6 +49,18 @@ O .
47
49
  </script>
48
50
  ```
49
51
 
52
+ ### Auto-init (no JavaScript required)
53
+
54
+ ```html
55
+ <script src="https://unpkg.com/godash-diagrams/dist/godash-diagrams.auto.iife.js"></script>
56
+ <div class="godash-diagram">
57
+ static
58
+
59
+ O .
60
+ . X
61
+ </div>
62
+ ```
63
+
50
64
  ## License
51
65
 
52
66
  ISC
@@ -0,0 +1,4 @@
1
+ (function(){"use strict";var vr="@@__IMMUTABLE_INDEXED__@@";function X(r){return!!(r&&r[vr])}var yr="@@__IMMUTABLE_KEYED__@@";function T(r){return!!(r&&r[yr])}function Fr(r){return T(r)||X(r)}var bi="@@__IMMUTABLE_ITERABLE__@@";function F(r){return!!(r&&r[bi])}var B=function(t){return F(t)?t:D(t)},V=(function(r){function t(e){return T(e)?e:gt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(B),It=(function(r){function t(e){return X(e)?e:rt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(B),zt=(function(r){function t(e){return F(e)&&!Fr(e)?e:kt(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t})(B);B.Keyed=V,B.Indexed=It,B.Set=zt;var At=0,U=1,H=2,Ur=typeof Symbol=="function"&&Symbol.iterator,Ii="@@iterator",gr=Ur||Ii,S=function(t){this.next=t};S.prototype.toString=function(){return"[Iterator]"},S.KEYS=At,S.VALUES=U,S.ENTRIES=H,S.prototype.inspect=S.prototype.toSource=function(){return this.toString()},S.prototype[gr]=function(){return this};function z(r,t,e,n){var i=r===At?t:r===U?e:[t,e];return n?n.value=i:n={value:i,done:!1},n}function L(){return{value:void 0,done:!0}}function qi(r){return Array.isArray(r)?!0:!!mr(r)}function Mi(r){return!!(r&&typeof r.next=="function")}function Hr(r){var t=mr(r);return t&&t.call(r)}function mr(r){var t=r&&(Ur&&r[Ur]||r[Ii]);if(typeof t=="function")return t}function ks(r){var t=mr(r);return t&&t===r.entries}function Bs(r){var t=mr(r);return t&&t===r.keys}var Yt="delete",M=5,K=1<<M,P=K-1,m={};function Kr(){return{value:!1}}function Z(r){r&&(r.value=!0)}function Wr(){}function Ct(r){return r.size===void 0&&(r.size=r.__iterate(Oi)),r.size}function vt(r,t){if(typeof t!="number"){var e=t>>>0;if(""+e!==t||e===4294967295)return NaN;t=e}return t<0?Ct(r)+t:t}function Oi(){return!0}function Sr(r,t,e){return(r===0&&!Ri(r)||e!==void 0&&r<=-e)&&(t===void 0||e!==void 0&&t>=e)}function Jt(r,t){return Ei(r,t,0)}function wr(r,t){return Ei(r,t,t)}function Ei(r,t,e){return r===void 0?e:Ri(r)?t===1/0?t:Math.max(0,t+r)|0:t===void 0||t===r?r:Math.min(t,r)|0}function Ri(r){return r<0||r===0&&1/r===-1/0}var Ti="@@__IMMUTABLE_RECORD__@@";function qt(r){return!!(r&&r[Ti])}function nt(r){return F(r)||qt(r)}var yt="@@__IMMUTABLE_ORDERED__@@";function it(r){return!!(r&&r[yt])}var zi="@@__IMMUTABLE_SEQ__@@";function Gr(r){return!!(r&&r[zi])}var $t=Object.prototype.hasOwnProperty;function Ai(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 D=(function(r){function t(e){return e==null?Jr():nt(e)?e.toSeq():xs(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 L();var u=o[i?a-++s:s++];return z(n,u[0],u[1])})}return this.__iteratorUncached(n,i)},t})(B),gt=(function(r){function t(e){return e==null?Jr().toKeyedSeq():F(e)?T(e)?e.toSeq():e.fromEntrySeq():qt(e)?e.toSeq():Xr(e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t})(D),rt=(function(r){function t(e){return e==null?Jr():F(e)?T(e)?e.entrySeq():e.toIndexedSeq():qt(e)?e.toSeq().entrySeq():$i(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})(D),kt=(function(r){function t(e){return(F(e)&&!Fr(e)?e:rt(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})(D);D.isSeq=Gr,D.Keyed=gt,D.Set=kt,D.Indexed=rt,D.prototype[zi]=!0;var Bt=(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[vt(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 L();var u=i?a-++s:s++;return z(n,u,o[u])})},t})(rt),Yr=(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 $t.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 L();var f=a[i?s-++u:u++];return z(n,f,o[f])})},t})(gt);Yr.prototype[yt]=!0;var js=(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=Hr(o),s=0;if(Mi(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=Hr(o);if(!Mi(a))return new S(L);var s=0;return new S(function(){var u=a.next();return u.done?u:z(n,s++,u.value)})},t})(rt),Ci;function Jr(){return Ci||(Ci=new Bt([]))}function Xr(r){var t=Vr(r);if(t)return t.fromEntrySeq();if(typeof r=="object")return new Yr(r);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+r)}function $i(r){var t=Vr(r);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+r)}function xs(r){var t=Vr(r);if(t)return ks(r)?t.fromEntrySeq():Bs(r)?t.toSetSeq():t;if(typeof r=="object")return new Yr(r);throw new TypeError("Expected Array or collection object of values, or keyed object: "+r)}function Vr(r){return Ai(r)?new Bt(r):qi(r)?new js(r):void 0}function Xt(){return this.__ensureOwner()}function Vt(){return this.__ownerID?this:this.__ensureOwner(new Wr)}var Zt=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 br(r){return r>>>1&1073741824|r&3221225471}var Ls=Object.prototype.valueOf;function W(r){if(r==null)return ki(r);if(typeof r.hashCode=="function")return br(r.hashCode(r));var t=Hs(r);if(t==null)return ki(t);switch(typeof t){case"boolean":return t?1108378657:1108378656;case"number":return Ps(t);case"string":return t.length>Ks?Ns(t):Zr(t);case"object":case"function":return Fs(t);case"symbol":return Ds(t);default:if(typeof t.toString=="function")return Zr(t.toString());throw new Error("Value type "+typeof t+" cannot be hashed.")}}function ki(r){return r===null?1108378658:1108378659}function Ps(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 br(t)}function Ns(r){var t=ne[r];return t===void 0&&(t=Zr(r),ee===Ws&&(ee=0,ne={}),ee++,ne[r]=t),t}function Zr(r){for(var t=0,e=0;e<r.length;e++)t=31*t+r.charCodeAt(e)|0;return br(t)}function Ds(r){var t=Li[r];return t!==void 0||(t=xi(),Li[r]=t),t}function Fs(r){var t;if(Qr&&(t=te.get(r),t!==void 0)||(t=r[Mt],t!==void 0)||!ji&&(t=r.propertyIsEnumerable&&r.propertyIsEnumerable[Mt],t!==void 0||(t=Us(r),t!==void 0)))return t;if(t=xi(),Qr)te.set(r,t);else{if(Bi!==void 0&&Bi(r)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(ji)Object.defineProperty(r,Mt,{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[Mt]=t;else if(r.nodeType!==void 0)r[Mt]=t;else throw new Error("Unable to set a non-enumerable property on object.")}return t}var Bi=Object.isExtensible,ji=(function(){try{return Object.defineProperty({},"@",{}),!0}catch{return!1}})();function Us(r){if(r&&r.nodeType>0)switch(r.nodeType){case 1:return r.uniqueID;case 9:return r.documentElement&&r.documentElement.uniqueID}}function Hs(r){return r.valueOf!==Ls&&typeof r.valueOf=="function"?r.valueOf(r):r}function xi(){var r=++re;return re&1073741824&&(re=0),r}var Qr=typeof WeakMap=="function",te;Qr&&(te=new WeakMap);var Li=Object.create(null),re=0,Mt="__immutablehash__";typeof Symbol=="function"&&(Mt=Symbol(Mt));var Ks=16,Ws=255,ee=0,ne={},Ir=(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=ie(this,!0);return this._useKeys||(i.valueSeq=function(){return n._iter.toSeq().reverse()}),i},t.prototype.map=function(n,i){var o=this,a=Ui(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})(gt);Ir.prototype[yt]=!0;var Pi=(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&&Ct(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(U,i),s=0;return i&&Ct(this),new S(function(){var u=a.next();return u.done?u:z(n,i?o.size-++s:s++,u.value,u)})},t})(rt),Ni=(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(U,i);return new S(function(){var a=o.next();return a.done?a:z(n,a.value,a.value,a)})},t})(kt),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.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(n,i){var o=this;return this._iter.__iterate(function(a){if(a){Yi(a);var s=F(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(U,i);return new S(function(){for(;;){var a=o.next();if(a.done)return a;var s=a.value;if(s){Yi(s);var u=F(s);return z(n,u?s.get(0):s[0],u?s.get(1):s[1],a)}}})},t})(gt);Pi.prototype.cacheResult=Ir.prototype.cacheResult=Ni.prototype.cacheResult=Di.prototype.cacheResult=se;function Fi(r){var t=ot(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=se,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===H){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===U?At:U,n)},t}function Ui(r,t,e){var n=ot(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(H,o);return new S(function(){var s=a.next();if(s.done)return s;var u=s.value,f=u[0];return z(i,f,t.call(e,u[1],f,r),s)})},n}function ie(r,t){var e=this,n=ot(r);return n._iter=r,n.size=r.size,n.reverse=function(){return r},r.flip&&(n.flip=function(){var i=Fi(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=se,n.__iterate=function(i,o){var a=this,s=0;return o&&Ct(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&&Ct(r);var s=r.__iterator(H,!o);return new S(function(){var u=s.next();if(u.done)return u;var f=u.value;return z(i,t?f[0]:o?e.size-++a:a++,f[1],u)})},n}function Hi(r,t,e,n){var i=ot(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(H,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 z(o,n?h:u++,p,f)}})},i}function Gs(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 Ys(r,t,e){var n=T(r),i=(it(r)?_t():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=ae(r);return i.map(function(a){return O(r,o(a))}).asImmutable()}function Js(r,t,e){var n=T(r),i=[[],[]];r.__iterate(function(a,s){i[t.call(e,a,s,r)?1:0].push(n?[s,a]:a)});var o=ae(r);return i.map(function(a){return O(r,o(a))})}function oe(r,t,e,n){var i=r.size;if(Sr(t,e,i))return r;if(typeof i>"u"&&(t<0||e<0))return oe(r.toSeq().cacheResult(),t,e,n);var o=Jt(t,i),a=wr(e,i),s=a-o,u;s===s&&(u=s<0?0:s);var f=ot(r);return f.size=u===0?u:r.size&&u||void 0,!n&&Gr(r)&&u>=0&&(f.get=function(c,h){return c=vt(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(L);var p=r.__iterator(c,h),_=0,d=0;return new S(function(){for(;_++<o;)p.next();if(++d>u)return L();var v=p.next();return n||c===U||v.done?v:c===At?z(c,d-1,void 0,v):z(c,d-1,v.value[1],v)})},f}function Xs(r,t,e){var n=ot(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(H,o),u=!0;return new S(function(){if(!u)return L();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===H?f:z(i,h,p,f):(u=!1,L())})},n}function Ki(r,t,e,n){var i=ot(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(H,a),f=!0,c=0;return new S(function(){var h,p,_;do{if(h=u.next(),h.done)return n||o===U?h:o===At?z(o,c++,void 0,h):z(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===H?h:z(o,p,_,h)})},i}var Vs=(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[yr]=this._wrappedIterables[0][yr],this[vr]=this._wrappedIterables[0][vr],this[yt]=this._wrappedIterables[0][yt]}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=T(this),s=a?H:U,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(L);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})(D);function Zs(r,t){var e=T(r),n=[r].concat(t).map(function(o){return F(o)?e&&(o=V(o)):o=e?Xr(o):$i(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&&T(i)||X(r)&&X(i))return i}return new Vs(n)}function Wi(r,t,e){var n=ot(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)&&F(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===H&&(c=c[1]),(!t||s.length<t)&&F(c))s.push(a),a=c.__iterator(i,o);else return e?f:z(i,u++,c,f)}return L()})},n}function Qs(r,t,e){var n=ae(r);return r.toSeq().map(function(i,o){return n(t.call(e,i,o,r))}).flatten(!0)}function tu(r,t){var e=ot(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(U,i),a=0,s;return new S(function(){return(!s||a%2)&&(s=o.next(),s.done)?s:a%2?z(n,a++,t):z(n,a++,s.value,s)})},e}function jt(r,t,e){t||(t=Ji);var n=T(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?gt(o):X(r)?rt(o):kt(o)}function qr(r,t,e){if(t||(t=Ji),e){var n=r.toSeq().map(function(i,o){return[i,e(i,o,r)]}).reduce(function(i,o){return Gi(t,i[1],o[1])?o:i});return n&&n[0]}return r.reduce(function(i,o){return Gi(t,i,o)?o:i})}function Gi(r,t,e){var n=r(e,t);return n===0&&e!==t&&(e==null||e!==e)||n>0}function Mr(r,t,e,n){var i=ot(r),o=new Bt(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(U,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=B(h),Hr(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?L():z(a,f++,t.apply(null,h.map(function(p){return p.value})))})},i}function O(r,t){return r===t?r:Gr(r)?t:r.constructor(t)}function Yi(r){if(r!==Object(r))throw new TypeError("Expected [K, V] tuple: "+r)}function ae(r){return T(r)?V:X(r)?It:zt}function ot(r){return Object.create((T(r)?gt:X(r)?rt:kt).prototype)}function se(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):D.prototype.cacheResult.call(this)}function Ji(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 Xi(r){return!!(r&&typeof r.equals=="function"&&typeof r.hashCode=="function")}function G(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!!(Xi(r)&&Xi(t)&&r.equals(t))}function Vi(r,t,e,n){return Pt(r,[t],e,n)}function Zi(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return to(this,r)}function Qi(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 to(this,t,r)}function to(r,t,e){for(var n=[],i=0;i<t.length;i++){var o=V(t[i]);o.size!==0&&n.push(o)}return n.length===0?r:r.toSeq().size===0&&!r.__ownerID&&n.length===1?qt(r)?r:r.constructor(n[0]):r.withMutations(function(a){for(var s=e?function(f,c){Vi(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 ru=Object.prototype.toString;function eu(r){if(!r||typeof r!="object"||ru.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 mt(r){return typeof r=="object"&&(nt(r)||Array.isArray(r)||eu(r))}function at(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 Or(r){if(Array.isArray(r))return at(r);var t={};for(var e in r)$t.call(r,e)&&(t[e]=r[e]);return t}function ue(r,t,e){return fe(r,t,nu(e))}function fe(r,t,e){if(!mt(r))throw new TypeError("Cannot merge into non-data-structure value: "+r);if(nt(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?It:V,a=n?function(u){i===r&&(i=Or(i)),i.push(u)}:function(u,f){var c=$t.call(i,f),h=c&&e?e(i[f],u,f):u;(!c||h!==i[f])&&(i===r&&(i=Or(i)),i[f]=h)},s=0;s<t.length;s++)o(t[s]).forEach(a);return i}function nu(r){function t(e,n,i){return mt(e)&&mt(n)&&iu(e,n)?fe(e,[n],t):r?r(e,n,i):n}return t}function iu(r,t){var e=D(r),n=D(t);return X(e)===X(n)&&T(e)===T(n)}function ro(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];return ue(this,r)}function eo(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return ue(this,t,r)}function ce(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Pt(this,r,st(),function(n){return ue(n,t)})}function he(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];return Pt(this,r,st(),function(n){return fe(n,t)})}function ou(r,t,e){return Pt(r,t,m,function(){return e})}function pe(r,t){return ou(this,r,t)}function _e(r,t,e){return arguments.length===1?r(this):Vi(this,r,t,e)}function de(r,t,e){return Pt(this,r,t,e)}function le(){return this.__altered}function Qt(r){var t=this.asMutable();return r(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}var no="@@__IMMUTABLE_MAP__@@";function ve(r){return!!(r&&r[no])}function tr(r,t){if(!r)throw new Error(t)}function Y(r){tr(r!==1/0,"Cannot perform this action with an infinite size.")}var J=(function(r){function t(e){return e==null?st():ve(e)&&!it(e)?e:st().withMutations(function(n){var i=r(e);Y(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 ao(this,n,i)},t.prototype.remove=function(n){return ao(this,n,m)},t.prototype.deleteAll=function(n){var i=B(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):st()},t.prototype.sort=function(n){return _t(jt(this,n))},t.prototype.sortBy=function(n,i){return _t(jt(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 au(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?ge(this.size,this._root,n,this.__hash):this.size===0?st():(this.__ownerID=n,this.__altered=!1,this)},t})(V);J.isMap=ve;var R=J.prototype;R[no]=!0,R[Yt]=R.remove,R.removeAll=R.deleteAll,R.setIn=pe,R.removeIn=R.deleteIn=we,R.update=_e,R.updateIn=de,R.merge=R.concat=Zi,R.mergeWith=Qi,R.mergeDeep=ro,R.mergeDeepWith=eo,R.mergeIn=he,R.mergeDeepIn=ce,R.withMutations=Qt,R.wasAltered=le,R.asImmutable=Xt,R["@@transducer/init"]=R.asMutable=Vt,R["@@transducer/step"]=function(r,t){return r.set(t[0],t[1])},R["@@transducer/result"]=function(r){return r.asImmutable()};var rr=function(t,e){this.ownerID=t,this.entries=e};rr.prototype.get=function(t,e,n,i){for(var o=this.entries,a=0,s=o.length;a<s;a++)if(G(n,o[a][0]))return o[a][1];return i},rr.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&&!G(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===o:u)return this;if(Z(s),(u||!p)&&Z(a),!(u&&f.length===1)){if(!p&&!u&&f.length>=pu)return su(t,f,i,o);var _=t&&t===this.ownerID,d=_?f:at(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 rr(t,d)}};var xt=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n};xt.prototype.get=function(t,e,n,i){e===void 0&&(e=W(n));var o=1<<((t===0?e:e>>>t)&P),a=this.bitmap;return(a&o)===0?i:this.nodes[uo(a&o-1)].get(t+M,e,n,i)},xt.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=W(i));var u=(e===0?n:n>>>e)&P,f=1<<u,c=this.bitmap,h=(c&f)!==0;if(!h&&o===m)return this;var p=uo(c&f-1),_=this.nodes,d=h?_[p]:void 0,v=me(d,t,e+M,n,i,o,a,s);if(v===d)return this;if(!h&&v&&_.length>=_u)return fu(t,_,c,u,v);if(h&&!v&&_.length===2&&so(_[p^1]))return _[p^1];if(h&&v&&_.length===1&&so(v))return v;var w=t&&t===this.ownerID,I=h?v?c:c^f:c|f,y=h?v?fo(_,p,v,w):hu(_,p,w):cu(_,p,v,w);return w?(this.bitmap=I,this.nodes=y,this):new xt(t,I,y)};var er=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n};er.prototype.get=function(t,e,n,i){e===void 0&&(e=W(n));var o=(t===0?e:e>>>t)&P,a=this.nodes[o];return a?a.get(t+M,e,n,i):i},er.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=W(i));var u=(e===0?n:n>>>e)&P,f=o===m,c=this.nodes,h=c[u];if(f&&!h)return this;var p=me(h,t,e+M,n,i,o,a,s);if(p===h)return this;var _=this.count;if(!h)_++;else if(!p&&(_--,_<du))return uu(t,c,_,u);var d=t&&t===this.ownerID,v=fo(c,u,p,d);return d?(this.count=_,this.nodes=v,this):new er(t,_,v)};var Lt=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n};Lt.prototype.get=function(t,e,n,i){for(var o=this.entries,a=0,s=o.length;a<s;a++)if(G(n,o[a][0]))return o[a][1];return i},Lt.prototype.update=function(t,e,n,i,o,a,s){n===void 0&&(n=W(i));var u=o===m;if(n!==this.keyHash)return u?this:(Z(s),Z(a),Se(this,t,e,n,[i,o]));for(var f=this.entries,c=0,h=f.length;c<h&&!G(i,f[c][0]);c++);var p=c<h;if(p?f[c][1]===o:u)return this;if(Z(s),(u||!p)&&Z(a),u&&h===2)return new pt(t,this.keyHash,f[c^1]);var _=t&&t===this.ownerID,d=_?f:at(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 Lt(t,this.keyHash,d)};var pt=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n};pt.prototype.get=function(t,e,n,i){return G(n,this.entry[0])?this.entry[1]:i},pt.prototype.update=function(t,e,n,i,o,a,s){var u=o===m,f=G(i,this.entry[0]);if(f?o===this.entry[1]:u)return this;if(Z(s),u){Z(a);return}return f?t&&t===this.ownerID?(this.entry[1]=o,this):new pt(t,this.keyHash,[i,o]):(Z(a),Se(this,t,e,W(i),[i,o]))},rr.prototype.iterate=Lt.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},xt.prototype.iterate=er.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}},pt.prototype.iterate=function(r,t){return r(this.entry)};var au=(function(r){function t(e,n,i){this._type=n,this._reverse=i,this._stack=e._root&&io(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 ye(n,o.entry)}else if(o.entries){if(s=o.entries.length-1,a<=s)return ye(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 ye(n,u.entry);i=this._stack=io(u,i)}continue}i=this._stack=this._stack.__prev}return L()},t})(S);function ye(r,t){return z(r,t[0],t[1])}function io(r,t){return{node:r,index:0,__prev:t}}function ge(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 oo;function st(){return oo||(oo=ge(0))}function ao(r,t,e){var n,i;if(r._root){var o=Kr(),a=Kr();if(n=me(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 rr(r.__ownerID,[[t,e]])}return r.__ownerID?(r.size=i,r._root=n,r.__hash=void 0,r.__altered=!0,r):n?ge(i,n):st()}function me(r,t,e,n,i,o,a,s){return r?r.update(t,e,n,i,o,a,s):o===m?r:(Z(s),Z(a),new pt(t,n,[i,o]))}function so(r){return r.constructor===pt||r.constructor===Lt}function Se(r,t,e,n,i){if(r.keyHash===n)return new Lt(t,n,[r.entry,i]);var o=(e===0?r.keyHash:r.keyHash>>>e)&P,a=(e===0?n:n>>>e)&P,s,u=o===a?[Se(r,t,e+M,n,i)]:(s=new pt(t,n,i),o<a?[r,s]:[s,r]);return new xt(t,1<<o|1<<a,u)}function su(r,t,e,n){r||(r=new Wr);for(var i=new pt(r,W(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 uu(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 xt(r,i,a)}function fu(r,t,e,n,i){for(var o=0,a=new Array(K),s=0;e!==0;s++,e>>>=1)a[s]=e&1?t[o++]:void 0;return a[n]=i,new er(r,o+1,a)}function uo(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 fo(r,t,e,n){var i=n?r:at(r);return i[t]=e,i}function cu(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 hu(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 pu=K/4,_u=K/2,du=K/4;function co(r){if(Ai(r)&&typeof r!="string")return r;if(it(r))return r.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+r)}function nr(r){try{return typeof r=="string"?JSON.stringify(r):String(r)}catch{return JSON.stringify(r)}}function lu(r,t){return nt(r)?r.has(t):mt(r)&&$t.call(r,t)}function ho(r,t,e){return nt(r)?r.get(t,e):lu(r,t)?typeof r.get=="function"?r.get(t):r[t]:e}function vu(r,t){if(!mt(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(nt(r)){if(!r.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+r);return r.remove(t)}if(!$t.call(r,t))return r;var e=Or(r);return Array.isArray(e)?e.splice(t,1):delete e[t],e}function yu(r,t,e){if(!mt(r))throw new TypeError("Cannot update non-data-structure value: "+r);if(nt(r)){if(!r.set)throw new TypeError("Cannot update immutable value without .set() method: "+r);return r.set(t,e)}if($t.call(r,t)&&e===r[t])return r;var n=Or(r);return n[t]=e,n}function Pt(r,t,e,n){n||(n=e,e=void 0);var i=po(nt(r),r,co(t),0,e,n);return i===m?e:i}function po(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&&!mt(t))throw new TypeError("Cannot update within non-data-structure value in path ["+Array.from(e).slice(0,n).map(nr)+"]: "+t);var f=e[n],c=a?m:ho(t,f,m),h=po(c===m?r:nt(c),c,e,n+1,i,o);return h===c?t:h===m?vu(t,f):yu(a?r?st():{}:t,f,h)}function gu(r,t){return Pt(r,t,function(){return m})}function we(r){return gu(this,r)}var _o="@@__IMMUTABLE_LIST__@@";function lo(r){return!!(r&&r[_o])}var Er=(function(r){function t(e){var n=Rr();if(e==null)return n;if(lo(e))return e;var i=r(e),o=i.size;return o===0?n:(Y(o),o>0&&o<K?or(0,o,M,null,new St(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=vt(this,n),n>=0&&n<this.size){n+=this._origin;var o=yo(this,n);return o&&o.array[n&P]}return i},t.prototype.set=function(n,i){return mu(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=M,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):Rr()},t.prototype.push=function(){var n=arguments,i=this.size;return this.withMutations(function(o){wt(o,0,i+n.length);for(var a=0;a<n.length;a++)o.set(i+a,n[a])})},t.prototype.pop=function(){return wt(this,0,-1)},t.prototype.unshift=function(){var n=arguments;return this.withMutations(function(i){wt(i,-n.length);for(var o=0;o<n.length;o++)i.set(o,n[o])})},t.prototype.shift=function(){return wt(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"&&qi(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 wt(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 Sr(n,i,o)?this:wt(this,Jt(n,o),wr(i,o))},t.prototype.__iterator=function(n,i){var o=i?this.size:0,a=vo(this,i);return new S(function(){var s=a();return s===ir?L():z(n,i?--o:o++,s)})},t.prototype.__iterate=function(n,i){for(var o=i?this.size:0,a=vo(this,i),s;(s=a())!==ir&&n(s,i?--o:o++,this)!==!1;);return o},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?or(this._origin,this._capacity,this._level,this._root,this._tail,n,this.__hash):this.size===0?Rr():(this.__ownerID=n,this.__altered=!1,this)},t})(It);Er.isList=lo;var $=Er.prototype;$[_o]=!0,$[Yt]=$.remove,$.merge=$.concat,$.setIn=pe,$.deleteIn=$.removeIn=we,$.update=_e,$.updateIn=de,$.mergeIn=he,$.mergeDeepIn=ce,$.withMutations=Qt,$.wasAltered=le,$.asImmutable=Xt,$["@@transducer/init"]=$.asMutable=Vt,$["@@transducer/step"]=function(r,t){return r.push(t)},$["@@transducer/result"]=function(r){return r.asImmutable()};var St=function(t,e){this.array=t,this.ownerID=e};St.prototype.removeBefore=function(t,e,n){if((n&(1<<e+M)-1)===0||this.array.length===0)return this;var i=n>>>e&P;if(i>=this.array.length)return new St([],t);var o=i===0,a;if(e>0){var s=this.array[i];if(a=s&&s.removeBefore(t,e-M,n),a===s&&o)return this}if(o&&!a)return this;var u=Nt(this,t);if(!o)for(var f=0;f<i;f++)u.array[f]=void 0;return a&&(u.array[i]=a),u},St.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e+M:K)||this.array.length===0)return this;var i=n-1>>>e&P;if(i>=this.array.length)return this;var o;if(e>0){var a=this.array[i];if(o=a&&a.removeAfter(t,e-M,n),o===a&&i===this.array.length-1)return this}var s=Nt(this,t);return s.array.splice(i+1),o&&(s.array[i]=o),s};var ir={};function vo(r,t){var e=r._origin,n=r._capacity,i=ar(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 _>K&&(_=K),function(){if(p===_)return ir;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>K&&(v=K),function(){for(;;){if(p){var w=p();if(w!==ir)return w;p=null}if(d===v)return ir;var I=t?--v:d++;p=a(_&&_[I],c-M,h+(I<<c))}}}}function or(r,t,e,n,i,o,a){var s=Object.create($);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 Rr(){return or(0,0,M)}function mu(r,t,e){if(t=vt(r,t),t!==t)return r;if(t>=r.size||t<0)return r.withMutations(function(a){t<0?wt(a,t).set(0,e):wt(a,0,t+1).set(t,e)});t+=r._origin;var n=r._tail,i=r._root,o=Kr();return t>=ar(r._capacity)?n=be(n,r.__ownerID,0,t,e,o):i=be(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):or(r._origin,r._capacity,r._level,i,n):r}function be(r,t,e,n,i,o){var a=n>>>e&P,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=be(f,t,e-M,n,i,o);return c===f?r:(u=Nt(r,t),u.array[a]=c,u)}return s&&r.array[a]===i?r:(o&&Z(o),u=Nt(r,t),i===void 0&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Nt(r,t){return t&&r&&t===r.ownerID?r:new St(r?r.array.slice():[],t)}function yo(r,t){if(t>=ar(r._capacity))return r._tail;if(t<1<<r._level+M){for(var e=r._root,n=r._level;e&&n>0;)e=e.array[t>>>n&P],n-=M;return e}}function wt(r,t,e){t!==void 0&&(t|=0),e!==void 0&&(e|=0);var n=r.__ownerID||new Wr,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 St(f&&f.array.length?[void 0,f]:[],n),u+=M,c+=1<<u;c&&(a+=c,i+=c,s+=c,o+=c);for(var h=ar(o),p=ar(s);p>=1<<u+M;)f=new St(f&&f.array.length?[f]:[],n),u+=M;var _=r._tail,d=p<h?yo(r,s-1):p>h?new St([],n):_;if(_&&p>h&&a<o&&_.array.length){f=Nt(f,n);for(var v=f,w=u;w>M;w-=M){var I=h>>>w&P;v=v.array[I]=Nt(v.array[I],n)}v.array[h>>>M&P]=_}if(s<o&&(d=d&&d.removeAfter(n,0,s)),a>=p)a-=p,s-=p,u=M,f=null,d=d&&d.removeBefore(n,0,a);else if(a>i||p<h){for(c=0;f;){var y=a>>>u&P;if(y!==p>>>u&P)break;y&&(c+=(1<<u)*y),u-=M,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):or(a,s,u,f,d)}function ar(r){return r<K?0:r-1>>>M<<M}function go(r){return ve(r)&&it(r)}var _t=(function(r){function t(e){return e==null?sr():go(e)?e:sr().withMutations(function(n){var i=V(e);Y(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):sr()},t.prototype.set=function(n,i){return So(this,n,i)},t.prototype.remove=function(n){return So(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?Ie(i,o,n,this.__hash):this.size===0?sr():(this.__ownerID=n,this.__altered=!1,this._map=i,this._list=o,this)},t})(J);_t.isOrderedMap=go,_t.prototype[yt]=!0,_t.prototype[Yt]=_t.prototype.remove;function Ie(r,t,e,n){var i=Object.create(_t.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 mo;function sr(){return mo||(mo=Ie(st(),Rr()))}function So(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>=K&&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):Ie(s,u)}var wo="@@__IMMUTABLE_STACK__@@";function qe(r){return!!(r&&r[wo])}var Me=(function(r){function t(e){return e==null?Tr():qe(e)?e:Tr().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=vt(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):ur(i,o)},t.prototype.pushAll=function(n){if(n=r(n),n.size===0)return this;if(this.size===0&&qe(n))return n;Y(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):ur(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):Tr()},t.prototype.slice=function(n,i){if(Sr(n,i,this.size))return this;var o=Jt(n,this.size),a=wr(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):ur(s,u)},t.prototype.__ensureOwner=function(n){return n===this.__ownerID?this:n?ur(this.size,this._head,n,this.__hash):this.size===0?Tr():(this.__ownerID=n,this.__altered=!1,this)},t.prototype.__iterate=function(n,i){var o=this;if(i)return new Bt(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 Bt(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,z(n,o++,s)}return L()})},t})(It);Me.isStack=qe;var N=Me.prototype;N[wo]=!0,N.shift=N.pop,N.unshift=N.push,N.unshiftAll=N.pushAll,N.withMutations=Qt,N.wasAltered=le,N.asImmutable=Xt,N["@@transducer/init"]=N.asMutable=Vt,N["@@transducer/step"]=function(r,t){return r.unshift(t)},N["@@transducer/result"]=function(r){return r.asImmutable()};function ur(r,t,e,n){var i=Object.create(N);return i.size=r,i._head=t,i.__ownerID=e,i.__hash=n,i.__altered=!1,i}var bo;function Tr(){return bo||(bo=ur(0))}function Io(r,t,e,n,i,o){return Y(r.size),r.__iterate(function(a,s,u){i?(i=!1,e=a):e=t.call(n,e,a,s,u)},o),e}function Su(r,t){return t}function wu(r,t){return[t,r]}function Oe(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return!r.apply(this,t)}}function qo(r){return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return-r.apply(this,t)}}function Mo(r,t){return r<t?1:r>t?-1:0}function Oo(r,t){if(r===t)return!0;if(!F(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||T(r)!==T(t)||X(r)!==X(t)||it(r)!==it(t))return!1;if(r.size===0&&t.size===0)return!0;var e=!Fr(r);if(it(r)){var n=r.entries();return t.every(function(u,f){var c=n.next().value;return c&&G(c[1],u)&&(e||G(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?!G(u,r.get(f,m)):!G(r.get(f,m),u))return a=!1,!1});return a&&r.size===s}var bu=(function(r){function t(e,n,i){if(i===void 0&&(i=1),!(this instanceof t))return new t(e,n,i);if(tr(i!==0,"Cannot step a Range by 0"),tr(e!==void 0,"You must define a start value when using Range"),tr(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(Ee)return Ee;Ee=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+vt(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 Sr(n,i,this.size)?this:(n=Jt(n,this.size),i=wr(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 L();var f=s;return s+=i?-a:a,z(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:Oo(this,n)},t})(rt),Ee,Eo="@@__IMMUTABLE_SET__@@";function Re(r){return!!(r&&r[Eo])}var ut=(function(r){function t(e){return e==null?fr():Re(e)&&!it(e)?e:fr().withMutations(function(n){var i=r(e);Y(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(V(n).keySeq())},t.intersect=function(n){return n=B(n).toArray(),n.length?k.intersect.apply(t(n.pop()),n):fr()},t.union=function(n){return n=B(n).toArray(),n.length?k.union.apply(t(n.pop()),n):fr()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(n){return this._map.has(n)},t.prototype.add=function(n){return zr(this,this._map.set(n,n))},t.prototype.remove=function(n){return zr(this,this._map.remove(n))},t.prototype.clear=function(){return zr(this,this._map.clear())},t.prototype.map=function(n,i){var o=this,a=!1,s=zr(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 hr(jt(this,n))},t.prototype.sortBy=function(n,i){return hr(jt(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})(zt);ut.isSet=Re;var k=ut.prototype;k[Eo]=!0,k[Yt]=k.remove,k.merge=k.concat=k.union,k.withMutations=Qt,k.asImmutable=Xt,k["@@transducer/init"]=k.asMutable=Vt,k["@@transducer/step"]=function(r,t){return r.add(t)},k["@@transducer/result"]=function(r){return r.asImmutable()},k.__empty=fr,k.__make=Ro;function zr(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 Ro(r,t){var e=Object.create(k);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var To;function fr(){return To||(To=Ro(st()))}function zo(r,t,e){for(var n=co(t),i=0;i!==n.length;)if(r=ho(r,n[i++],m),r===m)return e;return r}function Ao(r,t){return zo(this,r,t)}function Iu(r,t){return zo(r,t,m)!==m}function qu(r){return Iu(this,r)}function Co(){Y(this.size);var r={};return this.__iterate(function(t,e){r[e]=t}),r}function Ar(r){if(!r||typeof r!="object")return r;if(!F(r)){if(!mt(r))return r;r=D(r)}if(T(r)){var t={};return r.__iterate(function(n,i){t[i]=Ar(n)}),t}var e=[];return r.__iterate(function(n){e.push(Ar(n))}),e}function Mu(r){if(r.size===1/0)return 0;var t=it(r),e=T(r),n=t?1:0;return r.__iterate(e?t?function(i,o){n=31*n+$o(W(i),W(o))|0}:function(i,o){n=n+$o(W(i),W(o))|0}:t?function(i){n=31*n+W(i)|0}:function(i){n=n+W(i)|0}),Ou(r.size,n)}function Ou(r,t){return t=Zt(t,3432918353),t=Zt(t<<15|t>>>-15,461845907),t=Zt(t<<13|t>>>-13,5),t=(t+3864292196|0)^r,t=Zt(t^t>>>16,2246822507),t=Zt(t^t>>>13,3266489909),t=br(t^t>>>16),t}function $o(r,t){return r^t+2654435769+(r<<6)+(r>>2)|0}function Ot(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}B.Iterator=S,Ot(B,{toArray:function(){Y(this.size);var t=new Array(this.size||0),e=T(this),n=0;return this.__iterate(function(i,o){t[n++]=e?[o,i]:i}),t},toIndexedSeq:function(){return new Pi(this)},toJS:function(){return Ar(this)},toKeyedSeq:function(){return new Ir(this,!0)},toMap:function(){return J(this.toKeyedSeq())},toObject:Co,toOrderedMap:function(){return _t(this.toKeyedSeq())},toOrderedSet:function(){return hr(T(this)?this.valueSeq():this)},toSet:function(){return ut(T(this)?this.valueSeq():this)},toSetSeq:function(){return new Ni(this)},toSeq:function(){return X(this)?this.toIndexedSeq():T(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Me(T(this)?this.valueSeq():this)},toList:function(){return Er(T(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 O(this,Zs(this,t))},includes:function(t){return this.some(function(e){return G(e,t)})},entries:function(){return this.__iterator(H)},every:function(t,e){Y(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 O(this,Hi(this,t,e,!0))},partition:function(t,e){return Js(this,t,e)},find:function(t,e,n){var i=this.findEntry(t,e);return i?i[1]:n},forEach:function(t,e){return Y(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){Y(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(At)},map:function(t,e){return O(this,Ui(this,t,e))},reduce:function(t,e,n){return Io(this,t,e,n,arguments.length<2,!1)},reduceRight:function(t,e,n){return Io(this,t,e,n,arguments.length<2,!0)},reverse:function(){return O(this,ie(this,!0))},slice:function(t,e){return O(this,oe(this,t,e,!0))},some:function(t,e){Y(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 O(this,jt(this,t))},values:function(){return this.__iterator(U)},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 Ct(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return Gs(this,t,e)},equals:function(t){return Oo(this,t)},entrySeq:function(){var t=this;if(t._cache)return new Bt(t._cache);var e=t.toSeq().map(wu).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Oe(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(Oi,null,t)},flatMap:function(t,e){return O(this,Qs(this,t,e))},flatten:function(t){return O(this,Wi(this,t,!0))},fromEntrySeq:function(){return new Di(this)},get:function(t,e){return this.find(function(n,i){return G(i,t)},void 0,e)},getIn:Ao,groupBy:function(t,e){return Ys(this,t,e)},has:function(t){return this.get(t,m)!==m},hasIn:qu,isSubset:function(t){return t=typeof t.includes=="function"?t:B(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t=typeof t.isSubset=="function"?t:B(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return G(e,t)})},keySeq:function(){return this.toSeq().map(Su).toIndexedSeq()},last:function(t){return this.toSeq().reverse().first(t)},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return qr(this,t)},maxBy:function(t,e){return qr(this,e,t)},min:function(t){return qr(this,t?qo(t):Mo)},minBy:function(t,e){return qr(this,e?qo(e):Mo,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 O(this,Ki(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Oe(t),e)},sortBy:function(t,e){return O(this,jt(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 O(this,Xs(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Oe(t),e)},update:function(t){return t(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=Mu(this))}});var j=B.prototype;j[bi]=!0,j[gr]=j.values,j.toJSON=j.toArray,j.__toStringMapper=nr,j.inspect=j.toSource=function(){return this.toString()},j.chain=j.flatMap,j.contains=j.includes,Ot(V,{flip:function(){return O(this,Fi(this))},mapEntries:function(t,e){var n=this,i=0;return O(this,this.toSeq().map(function(o,a){return t.call(e,[a,o],i++,n)}).fromEntrySeq())},mapKeys:function(t,e){var n=this;return O(this,this.toSeq().flip().map(function(i,o){return t.call(e,i,o,n)}).flip())}});var cr=V.prototype;cr[yr]=!0,cr[gr]=j.entries,cr.toJSON=Co,cr.__toStringMapper=function(r,t){return nr(t)+": "+nr(r)},Ot(It,{toKeyedSeq:function(){return new Ir(this,!1)},filter:function(t,e){return O(this,Hi(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 O(this,ie(this,!1))},slice:function(t,e){return O(this,oe(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=Jt(t,t<0?this.count():this.size);var i=this.slice(0,t);return O(this,n===1?i:i.concat(at(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 O(this,Wi(this,t,!1))},get:function(t,e){return t=vt(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=vt(this,t),t>=0&&(this.size!==void 0?this.size===1/0||t<this.size:this.indexOf(t)!==-1)},interpose:function(t){return O(this,tu(this,t))},interleave:function(){var t=[this].concat(at(arguments)),e=Mr(this.toSeq(),rt.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),O(this,n)},keySeq:function(){return bu(0,this.size)},last:function(t){return this.get(-1,t)},skipWhile:function(t,e){return O(this,Ki(this,t,e,!1))},zip:function(){var t=[this].concat(at(arguments));return O(this,Mr(this,ko,t))},zipAll:function(){var t=[this].concat(at(arguments));return O(this,Mr(this,ko,t,!0))},zipWith:function(t){var e=at(arguments);return e[0]=this,O(this,Mr(this,t,e))}});var Dt=It.prototype;Dt[vr]=!0,Dt[yt]=!0,Ot(zt,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}});var Ft=zt.prototype;Ft.has=j.includes,Ft.contains=Ft.includes,Ft.keys=Ft.values,Ot(gt,cr),Ot(rt,Dt),Ot(kt,Ft);function ko(){return at(arguments)}function Bo(r){return Re(r)&&it(r)}var hr=(function(r){function t(e){return e==null?Te():Bo(e)?e:Te().withMutations(function(n){var i=zt(e);Y(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(V(n).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t})(ut);hr.isOrderedSet=Bo;var Et=hr.prototype;Et[yt]=!0,Et.zip=Dt.zip,Et.zipWith=Dt.zipWith,Et.zipAll=Dt.zipAll,Et.__empty=Te,Et.__make=jo;function jo(r,t){var e=Object.create(Et);return e.size=r?r.size:0,e._map=r,e.__ownerID=t,e}var xo;function Te(){return xo||(xo=jo(sr()))}function Eu(r){if(qt(r))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(nt(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 C=function(t,e){var n;Eu(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 "+Ae(this)+' with property "'+p+'" since that property name is part of the Record API.'):Ru(o,p)}}return this.__ownerID=void 0,this._values=Er().withMutations(function(_){_.setSize(u._keys.length),V(s).forEach(function(d,v){_.set(u._indices[v],d===u._defaultValues[v]?void 0:d)})}),this},o=i.prototype=Object.create(E);return o.constructor=i,e&&(i.displayName=e),i};C.prototype.toString=function(){for(var t=Ae(this)+" { ",e=this._keys,n,i=0,o=e.length;i!==o;i++)n=e[i],t+=(i?", ":"")+n+": "+nr(this.get(n));return t+" }"},C.prototype.equals=function(t){return this===t||qt(t)&&Ut(this).equals(Ut(t))},C.prototype.hashCode=function(){return Ut(this).hashCode()},C.prototype.has=function(t){return this._indices.hasOwnProperty(t)},C.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},C.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 ze(this,n)}return this},C.prototype.remove=function(t){return this.set(t)},C.prototype.clear=function(){var t=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:ze(this,t)},C.prototype.wasAltered=function(){return this._values.wasAltered()},C.prototype.toSeq=function(){return Ut(this)},C.prototype.toJS=function(){return Ar(this)},C.prototype.entries=function(){return this.__iterator(H)},C.prototype.__iterator=function(t,e){return Ut(this).__iterator(t,e)},C.prototype.__iterate=function(t,e){return Ut(this).__iterate(t,e)},C.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._values.__ensureOwner(t);return t?ze(this,e,t):(this.__ownerID=t,this._values=e,this)},C.isRecord=qt,C.getDescriptiveName=Ae;var E=C.prototype;E[Ti]=!0,E[Yt]=E.remove,E.deleteIn=E.removeIn=we,E.getIn=Ao,E.hasIn=j.hasIn,E.merge=Zi,E.mergeWith=Qi,E.mergeIn=he,E.mergeDeep=ro,E.mergeDeepWith=eo,E.mergeDeepIn=ce,E.setIn=pe,E.update=_e,E.updateIn=de,E.withMutations=Qt,E.asMutable=Vt,E.asImmutable=Xt,E[gr]=E.entries,E.toJSON=E.toObject=j.toObject,E.inspect=E.toSource=function(){return this.toString()};function ze(r,t,e){var n=Object.create(Object.getPrototypeOf(r));return n._values=t,n.__ownerID=e,n}function Ae(r){return r.constructor.displayName||r.constructor.name||"Record"}function Ut(r){return Xr(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){tr(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch{}}var Cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ce,Lo;function Po(){if(Lo)return Ce;Lo=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 Ce=r,Ce}var $e,No;function zu(){if(No)return $e;No=1;var r=typeof Cr=="object"&&Cr&&Cr.Object===Object&&Cr;return $e=r,$e}var ke,Do;function Be(){if(Do)return ke;Do=1;var r=zu(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return ke=e,ke}var je,Fo;function $r(){if(Fo)return je;Fo=1;var r=Be(),t=r.Symbol;return je=t,je}var xe,Uo;function Au(){if(Uo)return xe;Uo=1;var r=$r(),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 xe=o,xe}var Le,Ho;function Cu(){if(Ho)return Le;Ho=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return Le=e,Le}var Pe,Ko;function kr(){if(Ko)return Pe;Ko=1;var r=$r(),t=Au(),e=Cu(),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 Pe=a,Pe}var Ne,Wo;function Br(){if(Wo)return Ne;Wo=1;function r(t){return t!=null&&typeof t=="object"}return Ne=r,Ne}var De,Go;function $u(){if(Go)return De;Go=1;var r=kr(),t=Br(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return De=n,De}var Fe,Yo;function Jo(){if(Yo)return Fe;Yo=1;var r=$u(),t=Br(),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 Fe=o,Fe}var Ue,Xo;function bt(){if(Xo)return Ue;Xo=1;var r=Array.isArray;return Ue=r,Ue}var He,Vo;function ku(){if(Vo)return He;Vo=1;var r=$r(),t=Jo(),e=bt(),n=r?r.isConcatSpreadable:void 0;function i(o){return e(o)||t(o)||!!(n&&o&&o[n])}return He=i,He}var Ke,Zo;function Bu(){if(Zo)return Ke;Zo=1;var r=Po(),t=ku();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 Ke=e,Ke}var We,Qo;function ju(){if(Qo)return We;Qo=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 We=r,We}var Ge,ta;function xu(){if(ta)return Ge;ta=1;var r=Po(),t=Bu(),e=ju(),n=bt();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 Ge=i,Ge}xu();var Ye,ra;function Lu(){if(ra)return Ye;ra=1;function r(t,e){return t!=null&&e in Object(t)}return Ye=r,Ye}var Je,ea;function jr(){if(ea)return Je;ea=1;var r=kr(),t=Br(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return Je=n,Je}var Xe,na;function Pu(){if(na)return Xe;na=1;var r=bt(),t=jr(),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 Xe=i,Xe}var Ve,ia;function Ze(){if(ia)return Ve;ia=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return Ve=r,Ve}var Qe,oa;function Nu(){if(oa)return Qe;oa=1;var r=kr(),t=Ze(),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 Qe=a,Qe}var tn,aa;function Du(){if(aa)return tn;aa=1;var r=Be(),t=r["__core-js_shared__"];return tn=t,tn}var rn,sa;function Fu(){if(sa)return rn;sa=1;var r=Du(),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 rn=e,rn}var en,ua;function Uu(){if(ua)return en;ua=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 en=e,en}var nn,fa;function Hu(){if(fa)return nn;fa=1;var r=Nu(),t=Fu(),e=Ze(),n=Uu(),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 nn=h,nn}var on,ca;function Ku(){if(ca)return on;ca=1;function r(t,e){return t?.[e]}return on=r,on}var an,ha;function pa(){if(ha)return an;ha=1;var r=Hu(),t=Ku();function e(n,i){var o=t(n,i);return r(o)?o:void 0}return an=e,an}var sn,_a;function xr(){if(_a)return sn;_a=1;var r=pa(),t=r(Object,"create");return sn=t,sn}var un,da;function Wu(){if(da)return un;da=1;var r=xr();function t(){this.__data__=r?r(null):{},this.size=0}return un=t,un}var fn,la;function Gu(){if(la)return fn;la=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return fn=r,fn}var cn,va;function Yu(){if(va)return cn;va=1;var r=xr(),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 cn=i,cn}var hn,ya;function Ju(){if(ya)return hn;ya=1;var r=xr(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var o=this.__data__;return r?o[i]!==void 0:e.call(o,i)}return hn=n,hn}var pn,ga;function Xu(){if(ga)return pn;ga=1;var r=xr(),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 pn=e,pn}var _n,ma;function Vu(){if(ma)return _n;ma=1;var r=Wu(),t=Gu(),e=Yu(),n=Ju(),i=Xu();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 dn,Sa;function Zu(){if(Sa)return dn;Sa=1;function r(){this.__data__=[],this.size=0}return dn=r,dn}var ln,wa;function Qu(){if(wa)return ln;wa=1;function r(t,e){return t===e||t!==t&&e!==e}return ln=r,ln}var vn,ba;function Lr(){if(ba)return vn;ba=1;var r=Qu();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return vn=t,vn}var yn,Ia;function tf(){if(Ia)return yn;Ia=1;var r=Lr(),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 yn=n,yn}var gn,qa;function rf(){if(qa)return gn;qa=1;var r=Lr();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return gn=t,gn}var mn,Ma;function ef(){if(Ma)return mn;Ma=1;var r=Lr();function t(e){return r(this.__data__,e)>-1}return mn=t,mn}var Sn,Oa;function nf(){if(Oa)return Sn;Oa=1;var r=Lr();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 Sn=t,Sn}var wn,Ea;function of(){if(Ea)return wn;Ea=1;var r=Zu(),t=tf(),e=rf(),n=ef(),i=nf();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,wn=o,wn}var bn,Ra;function af(){if(Ra)return bn;Ra=1;var r=pa(),t=Be(),e=r(t,"Map");return bn=e,bn}var In,Ta;function sf(){if(Ta)return In;Ta=1;var r=Vu(),t=of(),e=af();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return In=n,In}var qn,za;function uf(){if(za)return qn;za=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return qn=r,qn}var Mn,Aa;function Pr(){if(Aa)return Mn;Aa=1;var r=uf();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Mn=t,Mn}var On,Ca;function ff(){if(Ca)return On;Ca=1;var r=Pr();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return On=t,On}var En,$a;function cf(){if($a)return En;$a=1;var r=Pr();function t(e){return r(this,e).get(e)}return En=t,En}var Rn,ka;function hf(){if(ka)return Rn;ka=1;var r=Pr();function t(e){return r(this,e).has(e)}return Rn=t,Rn}var Tn,Ba;function pf(){if(Ba)return Tn;Ba=1;var r=Pr();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 Tn=t,Tn}var zn,ja;function _f(){if(ja)return zn;ja=1;var r=sf(),t=ff(),e=cf(),n=hf(),i=pf();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,zn=o,zn}var An,xa;function df(){if(xa)return An;xa=1;var r=_f(),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,An=e,An}var Cn,La;function lf(){if(La)return Cn;La=1;var r=df(),t=500;function e(n){var i=r(n,function(a){return o.size===t&&o.clear(),a}),o=i.cache;return i}return Cn=e,Cn}var $n,Pa;function vf(){if(Pa)return $n;Pa=1;var r=lf(),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 $n=n,$n}var kn,Na;function yf(){if(Na)return kn;Na=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 kn=r,kn}var Bn,Da;function jn(){if(Da)return Bn;Da=1;var r=$r(),t=yf(),e=bt(),n=jr(),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 Bn=a,Bn}var xn,Fa;function Ln(){if(Fa)return xn;Fa=1;var r=jn();function t(e){return e==null?"":r(e)}return xn=t,xn}var Pn,Ua;function gf(){if(Ua)return Pn;Ua=1;var r=bt(),t=Pu(),e=vf(),n=Ln();function i(o,a){return r(o)?o:t(o,a)?[o]:e(n(o))}return Pn=i,Pn}var Nn,Ha;function mf(){if(Ha)return Nn;Ha=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 Nn=e,Nn}var Dn,Ka;function Sf(){if(Ka)return Dn;Ka=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return Dn=t,Dn}var Fn,Wa;function wf(){if(Wa)return Fn;Wa=1;var r=jr();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return Fn=t,Fn}var Un,Ga;function bf(){if(Ga)return Un;Ga=1;var r=gf(),t=Jo(),e=bt(),n=mf(),i=Sf(),o=wf();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 Un=a,Un}var Hn,Ya;function If(){if(Ya)return Hn;Ya=1;var r=Lu(),t=bf();function e(n,i){return n!=null&&t(n,i,r)}return Hn=e,Hn}If();var Kn,Ja;function qf(){if(Ja)return Kn;Ja=1;var r=Math.max,t=Math.min;function e(n,i,o){return n>=t(i,o)&&n<r(i,o)}return Kn=e,Kn}var Wn,Xa;function Mf(){if(Xa)return Wn;Xa=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return Wn=t,Wn}var Gn,Va;function Of(){if(Va)return Gn;Va=1;var r=Mf(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return Gn=e,Gn}var Yn,Za;function Qa(){if(Za)return Yn;Za=1;var r=Of(),t=Ze(),e=jr(),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 Yn=u,Yn}var Jn,ts;function rs(){if(ts)return Jn;ts=1;var r=Qa(),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 Jn=n,Jn}var Xn,es;function Ef(){if(es)return Xn;es=1;var r=qf(),t=rs(),e=Qa();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 Xn=n,Xn}var Rf=Ef();const Tf=Tu(Rf);var Vn,ns;function Zn(){if(ns)return Vn;ns=1;var r=rs();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return Vn=t,Vn}var Qn,is;function zf(){if(is)return Qn;is=1;var r=Zn();function t(e){return typeof e=="number"&&e==r(e)}return Qn=t,Qn}zf();var ti,os;function as(){if(os)return ti;os=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 ti=r,ti}var ri,ss;function Af(){if(ss)return ri;ss=1;var r=as(),t=Zn();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 ri=e,ri}Af();const pr="black",_r="white",Q=null;class us extends C({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={[pr]:pr,[_r]:_r,[Q]:Q},n=t||e;return Array(this.dimensions).fill(Q).map((i,o)=>Array(this.dimensions).fill(Q).map((a,s)=>{const u=this.moves.get(et(s,o),Q);return n[u]||e[u]}))}}function fs(...r){return Reflect.construct(us,r)}fs.prototype=us.prototype;class cs extends C({x:0,y:0},"Coordinate"){constructor(t,e){super({x:t,y:e})}}function et(...r){return Reflect.construct(cs,r)}et.prototype=cs.prototype;class hs extends C({coordinate:et(),color:Q},"Move"){constructor(t,e){super({coordinate:t,color:e})}}function ps(...r){return Reflect.construct(hs,r)}ps.prototype=hs.prototype,et(4,4),et(6,6),et(9,9);function Cf(r,t){const{x:e,y:n}=t,i=o=>Tf(o,r.dimensions);return ut.of(et(e,n+1),et(e,n-1),et(e+1,n),et(e-1,n)).filter(o=>i(o.x)&&i(o.y))}function Nr(r,t,e){const n=e===void 0?r.moves.get(t,Q):e;return Cf(r,t).filter(i=>r.moves.get(i,Q)===n)}function _s(r,t){let e=ut(),n=ut.of(t);for(;!n.isEmpty();){const i=n.first(),o=Nr(r,i);e=e.add(i),n=n.rest().union(o.subtract(e))}return e}function ei(r){return r===pr?_r:r===_r?pr:Q}function $f(r,t){return _s(r,t).reduce((e,n)=>e.union(Nr(r,n,Q)),ut())}function ni(r,t){return $f(r,t).size}function ds(r,t){const e=ni(r.setIn(["moves",t.coordinate],t.color),t.coordinate)>0,n=Nr(r,t.coordinate,ei(t.color)).some(i=>ni(r,i)===1);return e||n}function kf(r,t){return r.setIn(["moves"],t.reduce((e,n)=>e.delete(n),r.moves))}function Bf(r,t){if(!ds(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=Nr(r,t.coordinate,ei(t.color)).reduce((n,i)=>n.union(ni(r,i)===1?_s(r,i):ut()),ut());return kf(r,e).setIn(["moves",t.coordinate],t.color)}function jf(r,t,e,n=!1){const i=r.moves.get(t,Q);if(!n&&ei(i)===e)throw new Error("There is already a stone there. Pass force=true to override.");return r.setIn(["moves",t],e)}const dt={BLACK:pr,Board:fs,Coordinate:et,EMPTY:Q,Move:ps,WHITE:_r,addMove:Bf,isLegalMove:ds,placeStone:jf};bt();var ii,ls;function xf(){if(ls)return ii;ls=1;var r=kr(),t=bt(),e=Br(),n="[object String]";function i(o){return typeof o=="string"||!t(o)&&e(o)&&r(o)==n}return ii=i,ii}xf();var oi,vs;function Lf(){if(vs)return oi;vs=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 oi=r,oi}var ai,ys;function Pf(){if(ys)return ai;ys=1;var r=Lf(),t=jn(),e=Zn(),n=Ln();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 ai=i,ai}Pf();var si,gs;function Nf(){if(gs)return si;gs=1;var r=as();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 si=t,si}var ui,ms;function Df(){if(ms)return ui;ms=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 ui=r,ui}var fi,Ss;function Ff(){if(Ss)return fi;Ss=1;function r(t){return t!==t}return fi=r,fi}var ci,ws;function Uf(){if(ws)return ci;ws=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 ci=r,ci}var hi,bs;function Hf(){if(bs)return hi;bs=1;var r=Df(),t=Ff(),e=Uf();function n(i,o,a){return o===o?e(i,o,a):r(i,t,a)}return hi=n,hi}var pi,Is;function Kf(){if(Is)return pi;Is=1;var r=Hf();function t(e,n){for(var i=-1,o=e.length;++i<o&&r(n,e[i],0)>-1;);return i}return pi=t,pi}var _i,qs;function Wf(){if(qs)return _i;qs=1;function r(t){return t.split("")}return _i=r,_i}var di,Ms;function Gf(){if(Ms)return di;Ms=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 di=u,di}var li,Os;function Yf(){if(Os)return li;Os=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 li=g,li}var vi,Es;function Jf(){if(Es)return vi;Es=1;var r=Wf(),t=Gf(),e=Yf();function n(i){return t(i)?e(i):r(i)}return vi=n,vi}var yi,Rs;function Xf(){if(Rs)return yi;Rs=1;var r=jn(),t=Nf(),e=Kf(),n=Jf(),i=Ln(),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 yi=a,yi}Xf();const tt=dt.BLACK,gi=dt.Board,dr=dt.Coordinate,lr=dt.EMPTY,Rt=dt.Move,ft=dt.WHITE,Ht=dt.addMove,Ts=dt.isLegalMove,Vf=dt.placeStone;function Dr(r){return`
2
+ <div style="background: #fee2e2; color: #991b1b; padding: 1rem; border-radius: 4px;">${r}</div>
3
+ `}function mi(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,q=s+l*a;_+=`<circle cx="${A}" cy="${q}" r="3" fill="#000"/>`}for(let l=0;l<i;l++)for(let g=0;g<o;g++){const A=r.moves.get(dr(l,g),lr);if(A!==lr){const q=s+g*a,x=s+l*a;A===tt?_+=`<circle cx="${q}" cy="${x}" r="${u}" fill="#000" stroke="#000" stroke-width="1"/>`:A===ft&&(_+=`<circle cx="${q}" cy="${x}" r="${u}" fill="#fff" stroke="#000" stroke-width="1"/>`)}}return _+="</svg>",_}class ct extends Error{constructor(t){super(t),this.name="ValidationError"}}function Si(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 wi(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 ct("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=Si(r,s);let f;if(u.size){const y=u.size;if(Array.isArray(y))throw new ct("Size option cannot have multiple values");const l=parseInt(y,10);if(isNaN(l)||l<=1||l>19)throw new ct("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 ct("Board definition is required");if(!f)throw new ct('Empty board requires a "size" option');return{board:gi(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 ct("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 ct(`Board dimensions (${p}x${_}) exceed specified size (${f})`);if(!d&&!f)throw new ct(`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 q=l[A];if(q===" ")continue;const x=/^[.+XOxo]$/.test(q);if(n&&!x)throw new ct(`Invalid board character '${q}' at row ${y+1}, col ${g+1}. Valid characters: . or + (empty), X or x (black stone), O or o (white stone)`);let b=lr;q==="X"||q==="x"?b=tt:q==="O"||q==="o"?b=ft:q==="."||q==="+"?b=lr:n||(w[q]||(w[q]=[]),w[q].push(dr(y,g))),b!==lr&&v.push(Rt(dr(y,g),b)),g++}}let I;if(i){I=gi(f);for(const y of v)I=Vf(I,y.coordinate,y.color)}else I=gi(f,...v);return{board:I,rowCount:p,columnCount:_,configStartIndex:s,otherMarks:w}}const ht={Success:"success",Failure:"failure",Incomplete:"incomplete"};class zs{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=Si(e,i)["ignore-rules"],s=a==="true"||a==="1";this.parsedBoard=wi(e,{ignoreRules:s})}render(){const t=this.element,{board:e,rowCount:n,columnCount:i}=this.parsedBoard,o=mi(e,n,i);t.innerHTML=o}}class As{parsedBoard;element;toPlay;sequenceTree;result;currentTree;playedMoves;currentBoard;isBlackTurn;constructor(t,e){this.element=t;const n=wi(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=Si(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"?ft:tt;let d=n.board;for(const l of s){const g=n.otherMarks[l];for(const A of g)d=Ht(d,Rt(A,tt))}for(const l of u){const g=n.otherMarks[l];for(const A of g)d=Ht(d,Rt(A,ft))}this.parsedBoard={...n,board:d},this.result=ht.Incomplete,this.currentTree=J(),this.playedMoves=[],this.currentBoard=d,this.isBlackTurn=this.toPlay===tt;const v=(l,g)=>{const A=l.split(">").map(b=>b.trim()).filter(b=>b.length>0);for(const b of A)if(!n.otherMarks[b])throw new Error(`${g} '${l}': mark '${b}' does not appear in the board`);let q=d,x=this.toPlay;for(let b=0;b<A.length;b++){const lt=A[b],Tt=n.otherMarks[lt][0],Wt=Rt(Tt,x);if(!Ts(q,Wt))throw new Error(`${g} '${l}': move ${b+1} (${lt}) is illegal`);try{q=Ht(q,Wt)}catch(Gt){const rc=Gt instanceof Error?Gt.message:String(Gt);throw new Error(`${g} '${l}': move ${b+1} (${lt}) failed - ${rc}`)}x=x===tt?ft:tt}},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=J();for(const{sequence:l,isSolution:g}of I){const A=l.split(">").map(b=>b.trim()).filter(b=>b.length>0),q=[];for(const b of A)q.push(n.otherMarks[b][0]);let x=J();for(let b=q.length-1;b>=0;b--){const lt=q[b],Kt=b===q.length-1;let Tt;Kt?Tt=g?ht.Success:ht.Failure:Tt=ht.Incomplete;const Wt={result:Tt,children:x};x=J().set(lt,Wt)}this.sequenceTree=this.mergeSequenceTrees(this.sequenceTree,x)}this.currentTree=this.sequenceTree}mergeSequenceTrees(t,e){return e.reduce((n,i,o)=>{const a=n.get(o);if(a){const s=this.mergeSequenceTrees(a.children,i.children),c={result:s.size>0?ht.Incomplete:a.result,children:s};return n.set(o,c)}else return n.set(o,i)},t)}handleUserMove(t){const e=this.currentTree.get(t),n=this.isBlackTurn?tt:ft,i=Rt(t,n);if(this.playedMoves.push(i),this.currentBoard=Ht(this.currentBoard,i),this.isBlackTurn=!this.isBlackTurn,!e){this.result!==ht.Success&&(this.result=ht.Failure),this.currentTree=J(),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?tt:ft,a=Rt(n,o);this.playedMoves.push(a),this.currentBoard=Ht(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===tt,this.result=ht.Incomplete,this.render()}render(){const t=this.element,{rowCount:e,columnCount:n}=this.parsedBoard;let o=mi(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===ht.Success?o+='<span style="margin-left: 1rem; font-weight: 600; font-size: 1.1rem; color: #155724;">Success!</span>':this.result===ht.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=dr(y,I);this.handleUserMove(l)}}));const f=document.getElementById(a);f&&f.addEventListener("click",()=>this.reset())}}class Cs{parsedBoard;element;currentBoard;initialBoard;history;currentMoveIndex;isBlackTurn;constructor(t,e){this.element=t,this.parsedBoard=wi(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=Ht(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===ft}}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?tt:ft;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=mi(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,q=l.clientY-g.top,x=30,b=x,lt=Math.round((A-b)/x),Kt=Math.round((q-b)/x);if(Kt>=0&&Kt<e&&lt>=0&&lt<n){const Tt=dr(Kt,lt),Wt=this.isBlackTurn?tt:ft,Gt=Rt(Tt,Wt);Ts(this.currentBoard,Gt)&&(this.history=this.history.slice(0,this.currentMoveIndex+1),this.history.push({type:"move",move:Gt}),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 Zf={static:zs,freeplay:Cs,problem:As},Qf=".godash-diagram";function tc(r,t){const e=t.split(`
4
+ `);if(e.length===0){r.innerHTML=Dr("Empty diagram source");return}const n=e[0].trim();try{let i;switch(n){case"static":i=new zs(r,e);break;case"freeplay":i=new Cs(r,e);break;case"problem":i=new As(r,e);break;default:r.innerHTML=Dr(`Unsupported diagram type "${n}". Supported types: ${Object.keys(Zf).join(", ")}`);return}i.render()}catch(i){i instanceof ct?r.innerHTML=Dr(i.message):r.innerHTML=Dr(i instanceof Error?i.message:String(i))}}function $s(r,t){const e=Qf,n=document.querySelectorAll(e);if(n.length===0)throw new Error(`No elements found for selector: ${e}`);n.forEach(i=>{const o=i.textContent??"";tc(i,o)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{$s()}):$s()})();